Forráskód Böngészése

fix: mock数据优化

Jinyao 5 éve
szülő
commit
f1202cf013
2 módosított fájl, 128 hozzáadás és 145 törlés
  1. 2 5
      mock/routers/project.js
  2. 126 140
      mock/routers/tree.js

+ 2 - 5
mock/routers/project.js

@@ -6,20 +6,17 @@ const wrapper = require('../wrapper');
 
 const { Random } = Mock;
 
-const groups = [101, 102, 103, 104];
-
 router.get('/listByUser',
   (req, res) => {
     res.json(wrapper(
-      Mock.mock(Mock.mock({
+      Mock.mock({
         'data|5-10': [{
           'id|+1': 100,
           description: Random.csentence(5, 40),
           gitRemoteUrl: Random.url('http', 'gitlab.seecoder.cn'),
-          'groupId|1': groups,
           name: Random.cname(),
         }],
-      }).data),
+      }).data,
     ));
   });
 

+ 126 - 140
mock/routers/tree.js

@@ -59,93 +59,91 @@ router.get('/:projectId', (req, res) => {
   res.json(wrapper(
     Mock.mock([
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
+        deep: 1,
+        description: Random.csentence(10, 40),
+        endTime: Random.datetime(),
+        id: 1,
+        leaf: false,
+        parentId: null,
+        'priority|1': ['紧急', '一般', '宽松'],
+        processorId: 101,
+        processorName: 'Jinyao',
+        projectId: 101,
+        startTime: '2021-5-14 20:39:21',
+        state: '进行中',
+        timeToTake: 10,
+        title: '软件开发云系统',
+        'type|1': ['需求', '任务'],
+      },
+      {
         deep: 2,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 3,
+        id: 2,
         leaf: false,
         parentId: 1,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
-        processorName: 'Jinyao',
+        processorName: 'hkshu12',
         projectId: 101,
         startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
+        title: '需求管理模块',
         'type|1': ['需求', '任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
-        deep: 3,
+        deep: 2,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 9,
+        id: 3,
         leaf: false,
-        parentId: 2,
+        parentId: 1,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
         processorName: 'Jinyao',
         projectId: 101,
-        startTime: Random.datetime(),
+        startTime: '2021-5-14 20:39:21',
         'state|1': ['已创建', '进行中', '已完成'],
         timeToTake: 10,
-        title: Random.cname(),
+        title: '项目管理模块',
+        'type|1': ['需求', '任务'],
+      },
+      {
+        deep: 3,
+        description: '这是需求4。',
+        endTime: '',
+        id: 4,
+        leaf: false,
+        parentId: 3,
+        'priority|1': ['紧急', '一般', '宽松'],
+        processorId: 101,
+        processorName: 'Jinyao',
+        projectId: 101,
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
+        timeToTake: 10,
+        title: '成员管理',
         'type|1': ['需求', '任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
         deep: 3,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 10,
+        id: 5,
         leaf: false,
-        parentId: 2,
+        parentId: 3,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
         processorName: 'Jinyao',
         projectId: 101,
-        startTime: Random.datetime(),
+        startTime: '2021-5-14 20:39:21',
         'state|1': ['已创建', '进行中', '已完成'],
         timeToTake: 10,
-        title: Random.cname(),
+        title: '项目管理',
         'type|1': ['需求', '任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
         deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
@@ -156,159 +154,147 @@ router.get('/:projectId', (req, res) => {
         processorId: 101,
         processorName: 'Jinyao',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '创建项目',
+        'type|1': ['任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
-        deep: 3,
+        deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 4,
+        id: 7,
         leaf: false,
-        parentId: 3,
+        parentId: 5,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
         processorName: 'Jinyao',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '进行中',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '获取项目列表',
+        'type|1': ['任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
-        deep: 1,
+        deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 1,
+        id: 8,
         leaf: false,
-        parentId: null,
+        parentId: 5,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
         processorName: 'Jinyao',
         projectId: 101,
         startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        state: '已完成',
         timeToTake: 10,
-        title: Random.cname(),
+        title: '添加关联项目',
+        'type|1': ['任务'],
+      },
+      {
+        deep: 3,
+        description: '提供需求管理能力,包括增删改查功能',
+        endTime: '',
+        id: 9,
+        leaf: false,
+        parentId: 2,
+        'priority|1': ['紧急', '一般', '宽松'],
+        processorId: 101,
+        processorName: 'hkshu12',
+        projectId: 101,
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
+        timeToTake: 10,
+        title: '需求管理',
         'type|1': ['需求', '任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
         deep: 3,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 5,
+        id: 11,
         leaf: false,
-        parentId: 3,
+        parentId: 2,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
-        processorName: 'Jinyao',
+        processorName: 'hkshu12',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '需求树展示',
+        'type|1': ['需求'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
-        deep: 2,
+        deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 2,
+        id: 12,
         leaf: false,
-        parentId: 1,
+        parentId: 9,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
-        processorName: 'Jinyao',
+        processorName: 'hkshu12',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '需求增删改查',
+        'type|1': ['任务'],
       },
       {
-        'commits|0-10': [
-          {
-            'gitlabUsername|1': ['hks', 'wph', 'zxr', 'cyt'],
-            'id|+1': 101,
-            message: 'git commit message',
-
-            timestamp: Random.datetime(),
-            title: 'titleeee',
-          },
-        ],
         deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 7,
+        id: 13,
         leaf: false,
-        parentId: 5,
+        parentId: 11,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
-        processorName: 'Jinyao',
+        processorName: 'hkshu12',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '需求树可视化',
+        'type|1': ['任务'],
       },
       {
         deep: 4,
         description: Random.csentence(10, 40),
         endTime: Random.datetime(),
-        id: 8,
+        id: 14,
         leaf: false,
-        parentId: 5,
+        parentId: 4,
         'priority|1': ['紧急', '一般', '宽松'],
         processorId: 101,
-        processorName: 'Jinyao',
+        processorName: 'hkshu12',
         projectId: 101,
-        startTime: Random.datetime(),
-        'state|1': ['已创建', '进行中', '已完成'],
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
         timeToTake: 10,
-        title: Random.cname(),
-        'type|1': ['需求', '任务'],
+        title: '邀请成员加入项目',
+        'type|1': ['任务'],
+      },
+      {
+        deep: 4,
+        description: Random.csentence(10, 40),
+        endTime: Random.datetime(),
+        id: 15,
+        leaf: false,
+        parentId: 9,
+        'priority|1': ['紧急', '一般', '宽松'],
+        processorId: 101,
+        processorName: 'hkshu12',
+        projectId: 101,
+        startTime: '2021-5-14 20:39:21',
+        state: '已创建',
+        timeToTake: 10,
+        title: '这是一个新建的子节点',
+        'type|1': ['任务'],
       },
     ]),
   ));