/* 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; const groups = [101, 102, 103, 104]; router.get('/:projectId', (req, res) => { const { projectId: id } = req.params; res.json(wrapper( Mock.mock( { description: Random.csentence(5, 40), gitRemoteUrl: Random.url('http', 'gitlab.seecoder.cn'), groupId: 101, id, name: 'string', }, ), )); }); router.post('/create', (req, res) => { const { body } = req; body.id = 101; res.json(wrapper(body)); }); router.get('/listByUser/:userId', (req, res) => { res.json(wrapper( 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), )); }); router.get('/listByGroup/:groupId', (req, res) => { const { groupId } = req.params; res.json(wrapper( Mock.mock(Mock.mock({ 'data|3-5': [{ 'id|+1': 100, description: Random.csentence(5, 40), gitRemoteUrl: Random.url('http', 'gitlab.seecoder.cn'), groupId, name: Random.cname(), }], }).data), )); }); router.get('/delete/:projectId', (req, res) => { res.json(wrapper({})); }); module.exports = router;