| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- /* 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,
- parent: 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([{
- '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,
- parent: null,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 2,
- leaf: false,
- parent: 1,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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,
- description: Random.csentence(10, 40),
- endTime: Random.datetime(),
- id: 3,
- leaf: false,
- parent: 1,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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: 4,
- leaf: false,
- parent: 3,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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,
- leaf: false,
- parent: 3,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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: 6,
- leaf: false,
- parent: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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,
- leaf: false,
- parent: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- '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: 8,
- leaf: false,
- parent: 5,
- 'priority|1': ['紧急', '一般', '宽松'],
- processorId: 101,
- processorName: 'Jinyao',
- projectId: 101,
- startTime: Random.datetime(),
- 'state|1': ['已创建', '进行中', '已完成'],
- timeToTake: 10,
- title: Random.cname(),
- 'type|1': ['需求', '任务'],
- },
- ]),
- ));
- });
- module.exports = router;
|