| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /* 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;
|