| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- /* eslint-disable import/no-extraneous-dependencies */
- /* eslint-disable @typescript-eslint/no-var-requires */
- const router = require('express').Router();
- const Mock = require('mockjs');
- const wrapper = require('../wrapper');
- const { Random } = Mock;
- router.post('/node', (req, res) => {
- res.json(wrapper('success'));
- });
- router.put('/node', (req, res) => {
- res.json(wrapper('success'));
- });
- router.get('/node/type/task/:projectId', (req, res) => {
- res.json(wrapper(
- Mock.mock({
- 'data|5-20': [{
- 'commits|3-5': [
- {
- gitlabUsername: Random.name(),
- id: 'string',
- message: 'string',
- timestamp: Random.datetime(),
- title: 'string',
- },
- ],
- deep: 1,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- 'id|+1': 1,
- leaf: false,
- parentId: null,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成', '已结束'],
- timeToTake: 10,
- title: Random.cname(),
- 'type|1': ['需求', '任务'],
- }],
- }).data,
- ));
- });
- router.delete('/node/:nodeId', (req, res) => {
- res.json(wrapper('success'));
- });
- router.post('/subNode/:parentId', (req, res) => {
- res.json(wrapper('success'));
- });
- router.get('/:projectId', (req, res) => {
- res.json(wrapper(
- Mock.mock([
- {
- 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: 2,
- leaf: false,
- parentId: 1,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'hkshu12',
- projectId: 101,
- startTime: Random.datetime(),
- state: '已创建',
- timeToTake: 10,
- title: '需求管理模块',
- 'type|1': ['需求', '任务'],
- },
- {
- deep: 2,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 3,
- leaf: false,
- parentId: 1,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- 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': ['需求', '任务'],
- },
- {
- deep: 3,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 5,
- leaf: false,
- parentId: 3,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: '项目管理',
- 'type|1': ['需求', '任务'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 6,
- leaf: false,
- parentId: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- state: '已创建',
- timeToTake: 10,
- title: '创建项目',
- 'type|1': ['任务'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 7,
- leaf: false,
- parentId: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- state: '进行中',
- timeToTake: 10,
- title: '获取项目列表',
- 'type|1': ['任务'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 8,
- leaf: false,
- parentId: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- state: '已完成',
- timeToTake: 10,
- 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': ['需求', '任务'],
- },
- {
- deep: 3,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 11,
- 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': ['需求'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 12,
- 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': ['任务'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 13,
- leaf: false,
- parentId: 11,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'hkshu12',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- state: '已创建',
- timeToTake: 10,
- title: '需求树可视化',
- 'type|1': ['任务'],
- },
- {
- deep: 4,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 14,
- leaf: false,
- parentId: 4,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'hkshu12',
- projectId: 101,
- startTime: '2021-5-14 20:39:21',
- state: '已创建',
- timeToTake: 10,
- 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': ['任务'],
- },
- ]),
- ));
- });
- module.exports = router;
|