mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-12 15:10:23 +08:00
Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev2
This commit is contained in:
commit
af754fe234
@ -24,7 +24,6 @@ const loginActions = (data) => {
|
||||
data: res
|
||||
}
|
||||
});
|
||||
location.reload()
|
||||
} else {
|
||||
console.log('登录失败,errcode不为0');
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import './index.scss'
|
||||
import React, { Component } from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import { Route} from 'react-router-dom'
|
||||
import { Route, Redirect} from 'react-router-dom'
|
||||
import LeftMenu from './LeftMenu.js'
|
||||
import List from './List.js'
|
||||
import PropTypes from 'prop-types'
|
||||
@ -29,7 +29,6 @@ class User extends Component {
|
||||
<section className="user-box">
|
||||
|
||||
<LeftMenu />
|
||||
|
||||
<Route path={this.props.match.path + '/list'} component={List} />
|
||||
<Route path={this.props.match.path + '/profile/:uid'} component={Profile} />
|
||||
</section>
|
||||
|
@ -5,23 +5,30 @@
|
||||
-webkit-box-flex: 1;
|
||||
margin: .88rem auto 0 auto;
|
||||
font-size: 0.14rem;
|
||||
background: #FFF;
|
||||
|
||||
min-height:500px;
|
||||
margin-top: 84px;
|
||||
|
||||
ul{border:none}
|
||||
|
||||
|
||||
.user-list {
|
||||
width: 216px;
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||
background: #FFF;
|
||||
border-radius:5px;
|
||||
.search{
|
||||
margin: 5px;
|
||||
}
|
||||
ul{border:none}
|
||||
}
|
||||
|
||||
.user-table {
|
||||
-webkit-box-flex: 1;
|
||||
padding-right: 15px;
|
||||
padding: 15px;
|
||||
margin-left: 15px;
|
||||
border-radius:5px;
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||
background: #FFF;
|
||||
.ant-table-wrapper table {
|
||||
font-size: .14rem;
|
||||
|
||||
@ -35,7 +42,10 @@
|
||||
-webkit-box-flex: 1;
|
||||
margin-top: 15px;
|
||||
margin-left: 15px;
|
||||
|
||||
padding: 10px;
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||
background: #FFF;
|
||||
border-radius:5px;
|
||||
.user-item {
|
||||
min-height:35px;
|
||||
line-height:35px;
|
||||
|
@ -54,6 +54,7 @@ class interfaceController extends baseController{
|
||||
try{
|
||||
let data = {
|
||||
project_id: params.project_id,
|
||||
title: params.title,
|
||||
path: params.path,
|
||||
desc: params.desc,
|
||||
method: params.method,
|
||||
@ -124,7 +125,7 @@ class interfaceController extends baseController{
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加项目分组
|
||||
* 编辑接口
|
||||
* @interface /interface/up
|
||||
* @method POST
|
||||
* @category interface
|
||||
|
181
server/controllers/node.js
Normal file
181
server/controllers/node.js
Normal file
@ -0,0 +1,181 @@
|
||||
import nodeModel from '../models/node.js'
|
||||
import yapi from '../yapi.js'
|
||||
import baseController from './base.js'
|
||||
import interfaceModel from '../models/interface.js'
|
||||
import groupModel from '../models/group'
|
||||
import commons from '../utils/commons.js'
|
||||
|
||||
class nodeController extends baseController {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
this.Model = yapi.getInst(nodeModel);
|
||||
this.groupModel = yapi.getInst(groupModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加记录节点
|
||||
* @interface /node/add
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {String} title 节点名称,不能为空
|
||||
* @param {String} content 节点内容,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/node/add.json
|
||||
*/
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
|
||||
if(!params.title) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, 'title不能为空');
|
||||
}
|
||||
if(!params.content) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, 'content不能为空');
|
||||
}
|
||||
|
||||
let data = {
|
||||
title: params.title,
|
||||
content: params.content,
|
||||
is_read: false,
|
||||
uid: this.getUid(),
|
||||
add_time: yapi.commons.time()
|
||||
};
|
||||
|
||||
try {
|
||||
let result = await this.Model.save(data);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch(e) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点
|
||||
* @interface /node/get
|
||||
* @method GET
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/node/get.json
|
||||
*/
|
||||
|
||||
async get(ctx){
|
||||
let params = ctx.request.query;
|
||||
if(!params.id){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '节点id不能为空');
|
||||
}
|
||||
|
||||
try {
|
||||
let result = await this.Model.get(params.id);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch(e){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
* @interface /node/list
|
||||
* @method GET
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} uid 用户id, 不能为空
|
||||
* @param {Number} [page] 分页页码
|
||||
* @param {Number} [limit] 分页大小
|
||||
* @returns {Object}
|
||||
* @example ./api/project/list.json
|
||||
*/
|
||||
|
||||
async list(ctx) {
|
||||
let uid = ctx.request.query.uid,
|
||||
page = ctx.request.query.page || 1,
|
||||
limit = ctx.request.query.limit || 10;
|
||||
|
||||
if(!uid){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '用户id不能为空');
|
||||
}
|
||||
|
||||
try {
|
||||
let result = await this.Model.listWithPaging(uid, page, limit);
|
||||
let count = await this.Model.listCount(uid);
|
||||
ctx.body = yapi.commons.resReturn({
|
||||
total: Math.ceil(count / limit),
|
||||
list: result
|
||||
})
|
||||
} catch(err) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
* @interface /node/del
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/project/del.json
|
||||
*/
|
||||
|
||||
async del(ctx){
|
||||
try{
|
||||
let id = ctx.request.body.id;
|
||||
if(!id){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '节点id不能为空');
|
||||
}
|
||||
|
||||
let result = await this.Model.del(id);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
}catch(err){
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑节点
|
||||
* @interface /node/up
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @param {String} [title]
|
||||
* @param {String} [content] 节点描述
|
||||
* @param {Boolean} [is_read] 是否阅读
|
||||
* @returns {Object}
|
||||
* @example ./api/node/up.json
|
||||
*/
|
||||
|
||||
async up(ctx){
|
||||
try{
|
||||
let id = ctx.request.body.id;
|
||||
let params = ctx.request.body;
|
||||
|
||||
if(await this.jungeMemberAuth(id, this.getUid()) !== true){
|
||||
return ctx.body = yapi.commons.resReturn(null, 405, '没有权限');
|
||||
}
|
||||
|
||||
if(!id){
|
||||
return ctx.body = yapi.commons.resReturn(null, 402, '节点id不能为空');
|
||||
}
|
||||
|
||||
let data= {
|
||||
uid: this.getUid(),
|
||||
up_time: yapi.commons.time()
|
||||
};
|
||||
|
||||
if(params.title) data.title = params.title;
|
||||
if(params.content) data.content = params.content;
|
||||
if(params.is_read) data.is_read = params.is_read;
|
||||
|
||||
let result = await this.Model.up(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result)
|
||||
} catch(e) {
|
||||
ctx.body = yapi.commons.resReturn(null, 402, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = nodeController;
|
@ -67,9 +67,9 @@ class interfaceModel extends baseModel{
|
||||
})
|
||||
}
|
||||
|
||||
list (group_id){
|
||||
list (project_id){
|
||||
return this.model.find({
|
||||
group_id: group_id
|
||||
project_id: project_id
|
||||
}).exec()
|
||||
}
|
||||
|
||||
|
63
server/models/node.js
Normal file
63
server/models/node.js
Normal file
@ -0,0 +1,63 @@
|
||||
import yapi from '../yapi.js';
|
||||
import baseModel from './base.js';
|
||||
|
||||
class nodeModel extends baseModel {
|
||||
getName() {
|
||||
return 'node';
|
||||
}
|
||||
|
||||
getSchema() {
|
||||
return {
|
||||
uid: {type: Number, required: true},
|
||||
title: {type: String, required: true},
|
||||
content: {type: String, required: true},
|
||||
is_read: {type: Boolean, required: true},
|
||||
add_time: Number
|
||||
}
|
||||
}
|
||||
|
||||
save(data) {
|
||||
let node = new this.model(data);
|
||||
return node.save();
|
||||
}
|
||||
|
||||
get(id){
|
||||
return this.model.findOne({
|
||||
_id: id
|
||||
}).exec()
|
||||
}
|
||||
|
||||
list (uid){
|
||||
return this.model.find({
|
||||
uid: uid
|
||||
}).exec()
|
||||
}
|
||||
|
||||
listWithPaging(uid, page, limit) {
|
||||
page = parseInt(page);
|
||||
limit = parseInt(limit);
|
||||
return this.model.find({
|
||||
uid: uid
|
||||
}).skip((page - 1) * limit).limit(limit).exec();
|
||||
}
|
||||
|
||||
listCount(uid) {
|
||||
return this.model.count({
|
||||
uid: uid
|
||||
});
|
||||
}
|
||||
|
||||
del(id){
|
||||
return this.model.deleteOne({
|
||||
_id: id
|
||||
})
|
||||
}
|
||||
up(id, data){
|
||||
data.up_time = yapi.commons.time();
|
||||
return this.model.update({
|
||||
_id: id,
|
||||
}, data, { runValidators: true })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = nodeModel;
|
@ -5,6 +5,7 @@ import userController from './controllers/user.js'
|
||||
|
||||
import yapi from './yapi.js'
|
||||
import projectController from './controllers/project.js'
|
||||
import nodeController from './controllers/node.js'
|
||||
|
||||
|
||||
const router = koaRouter();
|
||||
@ -25,6 +26,10 @@ const INTERFACE_CONFIG = {
|
||||
project: {
|
||||
prefix: '/project/',
|
||||
controller: projectController
|
||||
},
|
||||
node: {
|
||||
prefix: '/node/',
|
||||
controller: nodeController
|
||||
}
|
||||
};
|
||||
|
||||
@ -66,6 +71,13 @@ createAction('interface', 'get', 'get', 'get')
|
||||
createAction('interface', 'up', 'post', 'up')
|
||||
createAction('interface', 'del', 'post', 'del')
|
||||
|
||||
//node
|
||||
createAction('node', 'add', 'post', 'add');
|
||||
createAction('node', 'get', 'get', 'get');
|
||||
createAction('node', 'list', 'get', 'list');
|
||||
createAction('node', 'del', 'post', 'del');
|
||||
createAction('node', 'up', 'post', 'up');
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -61,6 +61,7 @@ var interfaceController = function (_baseController) {
|
||||
* @category interface
|
||||
* @foldnumber 10
|
||||
* @param {Number} project_id 项目id,不能为空
|
||||
* @param {String} title 接口标题,不能为空
|
||||
* @param {String} path 接口请求路径,不能为空
|
||||
* @param {String} method 请求方式
|
||||
* @param {Array} [req_headers] 请求的header信息
|
||||
@ -128,6 +129,7 @@ var interfaceController = function (_baseController) {
|
||||
_context.prev = 12;
|
||||
data = {
|
||||
project_id: params.project_id,
|
||||
title: params.title,
|
||||
path: params.path,
|
||||
desc: params.desc,
|
||||
method: params.method,
|
||||
@ -141,30 +143,31 @@ var interfaceController = function (_baseController) {
|
||||
};
|
||||
|
||||
|
||||
if (data.req_params_type === 'form') data.req_params_form = params.req_params;else data.req_params_other = params.req_params;
|
||||
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||
|
||||
_context.next = 17;
|
||||
_context.next = 18;
|
||||
return this.Model.save(data);
|
||||
|
||||
case 17:
|
||||
case 18:
|
||||
result = _context.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 24;
|
||||
_context.next = 25;
|
||||
break;
|
||||
|
||||
case 21:
|
||||
_context.prev = 21;
|
||||
case 22:
|
||||
_context.prev = 22;
|
||||
_context.t0 = _context['catch'](12);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 24:
|
||||
case 25:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this, [[12, 21]]);
|
||||
}, _callee, this, [[12, 22]]);
|
||||
}));
|
||||
|
||||
function add(_x) {
|
||||
@ -299,7 +302,7 @@ var interfaceController = function (_baseController) {
|
||||
}()
|
||||
|
||||
/**
|
||||
* 添加项目分组
|
||||
* 编辑接口
|
||||
* @interface /interface/up
|
||||
* @method POST
|
||||
* @category interface
|
||||
@ -371,39 +374,41 @@ var interfaceController = function (_baseController) {
|
||||
|
||||
|
||||
if (params.path) data.path = params.path;
|
||||
if (params.title) data.title = params.title;
|
||||
if (params.desc) data.desc = params.desc;
|
||||
if (params.method) data.method = params.method;
|
||||
|
||||
if (params.req_headers) data.req_headers = params.req_headers;
|
||||
|
||||
if (params.req_params_type === 'form') data.req_params_form = params.req_params;else data.req_params_other = params.req_params;
|
||||
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||
|
||||
if (params.res_body_type) data.res_body_type = params.res_body_type;
|
||||
if (params.res_body) data.res_body = params.res_body;
|
||||
|
||||
_context4.prev = 19;
|
||||
_context4.next = 22;
|
||||
_context4.prev = 21;
|
||||
_context4.next = 24;
|
||||
return this.Model.up(id, data);
|
||||
|
||||
case 22:
|
||||
case 24:
|
||||
result = _context4.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context4.next = 29;
|
||||
_context4.next = 31;
|
||||
break;
|
||||
|
||||
case 26:
|
||||
_context4.prev = 26;
|
||||
_context4.t0 = _context4['catch'](19);
|
||||
case 28:
|
||||
_context4.prev = 28;
|
||||
_context4.t0 = _context4['catch'](21);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context4.t0.message);
|
||||
|
||||
case 29:
|
||||
case 31:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}, _callee4, this, [[19, 26]]);
|
||||
}, _callee4, this, [[21, 28]]);
|
||||
}));
|
||||
|
||||
function up(_x4) {
|
||||
|
437
server_dist/controllers/node.js
Normal file
437
server_dist/controllers/node.js
Normal file
@ -0,0 +1,437 @@
|
||||
'use strict';
|
||||
|
||||
var _regenerator = require('babel-runtime/regenerator');
|
||||
|
||||
var _regenerator2 = _interopRequireDefault(_regenerator);
|
||||
|
||||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
||||
|
||||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
||||
|
||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
||||
|
||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _node = require('../models/node.js');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _base = require('./base.js');
|
||||
|
||||
var _base2 = _interopRequireDefault(_base);
|
||||
|
||||
var _interface = require('../models/interface.js');
|
||||
|
||||
var _interface2 = _interopRequireDefault(_interface);
|
||||
|
||||
var _group = require('../models/group');
|
||||
|
||||
var _group2 = _interopRequireDefault(_group);
|
||||
|
||||
var _commons = require('../utils/commons.js');
|
||||
|
||||
var _commons2 = _interopRequireDefault(_commons);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var nodeController = function (_baseController) {
|
||||
(0, _inherits3.default)(nodeController, _baseController);
|
||||
|
||||
function nodeController(ctx) {
|
||||
(0, _classCallCheck3.default)(this, nodeController);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, (nodeController.__proto__ || (0, _getPrototypeOf2.default)(nodeController)).call(this, ctx));
|
||||
|
||||
_this.Model = _yapi2.default.getInst(_node2.default);
|
||||
_this.groupModel = _yapi2.default.getInst(_group2.default);
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加记录节点
|
||||
* @interface /node/add
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {String} title 节点名称,不能为空
|
||||
* @param {String} content 节点内容,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/node/add.json
|
||||
*/
|
||||
|
||||
|
||||
(0, _createClass3.default)(nodeController, [{
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, data, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
if (params.title) {
|
||||
_context.next = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, 'title不能为空'));
|
||||
|
||||
case 3:
|
||||
if (params.content) {
|
||||
_context.next = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, 'content不能为空'));
|
||||
|
||||
case 5:
|
||||
data = {
|
||||
title: params.title,
|
||||
content: params.content,
|
||||
is_read: false,
|
||||
uid: this.getUid(),
|
||||
add_time: _yapi2.default.commons.time()
|
||||
};
|
||||
_context.prev = 6;
|
||||
_context.next = 9;
|
||||
return this.Model.save(data);
|
||||
|
||||
case 9:
|
||||
result = _context.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 16;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
_context.prev = 13;
|
||||
_context.t0 = _context['catch'](6);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 16:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this, [[6, 13]]);
|
||||
}));
|
||||
|
||||
function add(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
return add;
|
||||
}()
|
||||
|
||||
/**
|
||||
* 获取节点
|
||||
* @interface /node/get
|
||||
* @method GET
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/node/get.json
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'get',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
params = ctx.request.query;
|
||||
|
||||
if (params.id) {
|
||||
_context2.next = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '节点id不能为空'));
|
||||
|
||||
case 3:
|
||||
_context2.prev = 3;
|
||||
_context2.next = 6;
|
||||
return this.Model.get(params.id);
|
||||
|
||||
case 6:
|
||||
result = _context2.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context2.next = 13;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
_context2.prev = 10;
|
||||
_context2.t0 = _context2['catch'](3);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context2.t0.message);
|
||||
|
||||
case 13:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this, [[3, 10]]);
|
||||
}));
|
||||
|
||||
function get(_x2) {
|
||||
return _ref2.apply(this, arguments);
|
||||
}
|
||||
|
||||
return get;
|
||||
}()
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
* @interface /node/list
|
||||
* @method GET
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} uid 用户id, 不能为空
|
||||
* @param {Number} [page] 分页页码
|
||||
* @param {Number} [limit] 分页大小
|
||||
* @returns {Object}
|
||||
* @example ./api/project/list.json
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var uid, page, limit, result, count;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
uid = ctx.request.query.uid, page = ctx.request.query.page || 1, limit = ctx.request.query.limit || 10;
|
||||
|
||||
if (uid) {
|
||||
_context3.next = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '用户id不能为空'));
|
||||
|
||||
case 3:
|
||||
_context3.prev = 3;
|
||||
_context3.next = 6;
|
||||
return this.Model.listWithPaging(uid, page, limit);
|
||||
|
||||
case 6:
|
||||
result = _context3.sent;
|
||||
_context3.next = 9;
|
||||
return this.Model.listCount(uid);
|
||||
|
||||
case 9:
|
||||
count = _context3.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn({
|
||||
total: Math.ceil(count / limit),
|
||||
list: result
|
||||
});
|
||||
_context3.next = 16;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
_context3.prev = 13;
|
||||
_context3.t0 = _context3['catch'](3);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 16:
|
||||
case 'end':
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3, this, [[3, 13]]);
|
||||
}));
|
||||
|
||||
function list(_x3) {
|
||||
return _ref3.apply(this, arguments);
|
||||
}
|
||||
|
||||
return list;
|
||||
}()
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
* @interface /node/del
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @returns {Object}
|
||||
* @example ./api/project/del.json
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var id, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
case 0:
|
||||
_context4.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
|
||||
if (id) {
|
||||
_context4.next = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context4.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '节点id不能为空'));
|
||||
|
||||
case 4:
|
||||
_context4.next = 6;
|
||||
return this.Model.del(id);
|
||||
|
||||
case 6:
|
||||
result = _context4.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context4.next = 13;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
_context4.prev = 10;
|
||||
_context4.t0 = _context4['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
|
||||
case 13:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}, _callee4, this, [[0, 10]]);
|
||||
}));
|
||||
|
||||
function del(_x4) {
|
||||
return _ref4.apply(this, arguments);
|
||||
}
|
||||
|
||||
return del;
|
||||
}()
|
||||
|
||||
/**
|
||||
* 编辑节点
|
||||
* @interface /node/up
|
||||
* @method POST
|
||||
* @category node
|
||||
* @foldnumber 10
|
||||
* @param {Number} id 节点id,不能为空
|
||||
* @param {String} [title]
|
||||
* @param {String} [content] 节点描述
|
||||
* @param {Boolean} [is_read] 是否阅读
|
||||
* @returns {Object}
|
||||
* @example ./api/node/up.json
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var id, params, data, result;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
switch (_context5.prev = _context5.next) {
|
||||
case 0:
|
||||
_context5.prev = 0;
|
||||
id = ctx.request.body.id;
|
||||
params = ctx.request.body;
|
||||
_context5.next = 5;
|
||||
return this.jungeMemberAuth(id, this.getUid());
|
||||
|
||||
case 5:
|
||||
_context5.t0 = _context5.sent;
|
||||
|
||||
if (!(_context5.t0 !== true)) {
|
||||
_context5.next = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context5.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '没有权限'));
|
||||
|
||||
case 8:
|
||||
if (id) {
|
||||
_context5.next = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context5.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 402, '节点id不能为空'));
|
||||
|
||||
case 10:
|
||||
data = {
|
||||
uid: this.getUid(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
|
||||
|
||||
if (params.title) data.title = params.title;
|
||||
if (params.content) data.content = params.content;
|
||||
if (params.is_read) data.is_read = params.is_read;
|
||||
|
||||
_context5.next = 16;
|
||||
return this.Model.up(id, data);
|
||||
|
||||
case 16:
|
||||
result = _context5.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context5.next = 23;
|
||||
break;
|
||||
|
||||
case 20:
|
||||
_context5.prev = 20;
|
||||
_context5.t1 = _context5['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context5.t1.message);
|
||||
|
||||
case 23:
|
||||
case 'end':
|
||||
return _context5.stop();
|
||||
}
|
||||
}
|
||||
}, _callee5, this, [[0, 20]]);
|
||||
}));
|
||||
|
||||
function up(_x5) {
|
||||
return _ref5.apply(this, arguments);
|
||||
}
|
||||
|
||||
return up;
|
||||
}()
|
||||
}]);
|
||||
return nodeController;
|
||||
}(_base2.default);
|
||||
|
||||
module.exports = nodeController;
|
@ -71,24 +71,53 @@ var projectController = function (_baseController) {
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加项目分组
|
||||
* @interface /project/add
|
||||
* @method POST
|
||||
* @category project
|
||||
* @foldnumber 10
|
||||
* @param {String} name 项目名称,不能为空
|
||||
* @param {String} basepath 项目基本路径,不能为空
|
||||
* @param {String} prd_host 项目线上域名,不能为空。可通过配置的域名访问到mock数据
|
||||
* @param {String} protocol 线上域名协议,不能为空
|
||||
* @param {Number} group_id 项目分组id,不能为空
|
||||
* @param {String} [desc] 项目描述
|
||||
* @returns {Object}
|
||||
* @example ./api/project/add.json
|
||||
*/
|
||||
|
||||
|
||||
(0, _createClass3.default)(projectController, [{
|
||||
key: 'handleBasepath',
|
||||
value: function handleBasepath(basepath) {
|
||||
if (!basepath) return false;
|
||||
if (basepath[0] !== '/') basepath = '/' + basepath;
|
||||
if (basepath[basepath.length - 1] === '/') basepath = basepath.substr(0, basepath.length - 1);
|
||||
if (!this.verifyPath(basepath)) {
|
||||
return false;
|
||||
}
|
||||
return basepath;
|
||||
}
|
||||
}, {
|
||||
key: 'verifyPath',
|
||||
value: function verifyPath(path) {
|
||||
if (/^[a-zA-Z0-9\-\/_:]+$/.test(basepath)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'verifyDomain',
|
||||
value: function verifyDomain(domain) {
|
||||
if (!domain) return false;
|
||||
if (/^[a-zA-Z0-9\-_\.]+[a-zA-Z]{2,6}$/.test(domain)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加项目分组
|
||||
* @interface /project/add
|
||||
* @method POST
|
||||
* @category project
|
||||
* @foldnumber 10
|
||||
* @param {String} name 项目名称,不能为空
|
||||
* @param {String} basepath 项目基本路径,不能为空
|
||||
* @param {String} prd_host 项目线上域名,不能为空。可通过配置的域名访问到mock数据
|
||||
* @param {String} protocol 线上域名协议,不能为空
|
||||
* @param {Number} group_id 项目分组id,不能为空
|
||||
* @param {String} [desc] 项目描述
|
||||
* @returns {Object}
|
||||
* @example ./api/project/add.json
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
@ -145,20 +174,36 @@ var projectController = function (_baseController) {
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目domain不能为空'));
|
||||
|
||||
case 14:
|
||||
_context.next = 16;
|
||||
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
||||
if (!(params.basepath = this.handleBasepath(params.basepath) === false)) {
|
||||
_context.next = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, 'basepath格式有误'));
|
||||
|
||||
case 16:
|
||||
if (this.verifyDomain(params.prd_host)) {
|
||||
_context.next = 18;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '线上域名格式有误'));
|
||||
|
||||
case 18:
|
||||
_context.next = 20;
|
||||
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
||||
|
||||
case 20:
|
||||
checkRepeatDomain = _context.sent;
|
||||
|
||||
if (!(checkRepeatDomain > 0)) {
|
||||
_context.next = 19;
|
||||
_context.next = 23;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
||||
|
||||
case 19:
|
||||
case 23:
|
||||
data = {
|
||||
name: params.name,
|
||||
desc: params.desc,
|
||||
@ -171,29 +216,29 @@ var projectController = function (_baseController) {
|
||||
add_time: _yapi2.default.commons.time(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
_context.prev = 20;
|
||||
_context.next = 23;
|
||||
_context.prev = 24;
|
||||
_context.next = 27;
|
||||
return this.Model.save(data);
|
||||
|
||||
case 23:
|
||||
case 27:
|
||||
result = _context.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 30;
|
||||
_context.next = 34;
|
||||
break;
|
||||
|
||||
case 27:
|
||||
_context.prev = 27;
|
||||
_context.t0 = _context['catch'](20);
|
||||
case 31:
|
||||
_context.prev = 31;
|
||||
_context.t0 = _context['catch'](24);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 30:
|
||||
case 34:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this, [[20, 27]]);
|
||||
}, _callee, this, [[24, 31]]);
|
||||
}));
|
||||
|
||||
function add(_x) {
|
||||
@ -743,6 +788,23 @@ var projectController = function (_baseController) {
|
||||
case 12:
|
||||
projectData = _context8.sent;
|
||||
|
||||
if (!(params.basepath = this.handleBasepath(params.basepath) === false)) {
|
||||
_context8.next = 15;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, 'basepath格式有误'));
|
||||
|
||||
case 15:
|
||||
if (this.verifyDomain(params.prd_host)) {
|
||||
_context8.next = 17;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '线上域名格式有误'));
|
||||
|
||||
case 17:
|
||||
|
||||
if (projectData.name === params.name) {
|
||||
delete params.name;
|
||||
}
|
||||
@ -752,43 +814,43 @@ var projectController = function (_baseController) {
|
||||
}
|
||||
|
||||
if (!params.name) {
|
||||
_context8.next = 21;
|
||||
_context8.next = 25;
|
||||
break;
|
||||
}
|
||||
|
||||
_context8.next = 18;
|
||||
_context8.next = 22;
|
||||
return this.Model.checkNameRepeat(params.name);
|
||||
|
||||
case 18:
|
||||
case 22:
|
||||
checkRepeat = _context8.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context8.next = 21;
|
||||
_context8.next = 25;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的项目名'));
|
||||
|
||||
case 21:
|
||||
case 25:
|
||||
if (!(params.basepath && params.prd_host)) {
|
||||
_context8.next = 27;
|
||||
_context8.next = 31;
|
||||
break;
|
||||
}
|
||||
|
||||
_context8.next = 24;
|
||||
_context8.next = 28;
|
||||
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
||||
|
||||
case 24:
|
||||
case 28:
|
||||
checkRepeatDomain = _context8.sent;
|
||||
|
||||
if (!(checkRepeatDomain > 0)) {
|
||||
_context8.next = 27;
|
||||
_context8.next = 31;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
||||
|
||||
case 27:
|
||||
case 31:
|
||||
data = {
|
||||
uid: this.getUid(),
|
||||
up_time: _yapi2.default.commons.time()
|
||||
@ -804,28 +866,28 @@ var projectController = function (_baseController) {
|
||||
if (params.protocol) data.protocol = params.protocol;
|
||||
if (params.env) data.env = params.env;
|
||||
|
||||
_context8.next = 35;
|
||||
_context8.next = 39;
|
||||
return this.Model.up(id, data);
|
||||
|
||||
case 35:
|
||||
case 39:
|
||||
result = _context8.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context8.next = 42;
|
||||
_context8.next = 46;
|
||||
break;
|
||||
|
||||
case 39:
|
||||
_context8.prev = 39;
|
||||
case 43:
|
||||
_context8.prev = 43;
|
||||
_context8.t1 = _context8['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context8.t1.message);
|
||||
|
||||
case 42:
|
||||
case 46:
|
||||
case 'end':
|
||||
return _context8.stop();
|
||||
}
|
||||
}
|
||||
}, _callee8, this, [[0, 39]]);
|
||||
}, _callee8, this, [[0, 43]]);
|
||||
}));
|
||||
|
||||
function up(_x8) {
|
||||
|
@ -47,13 +47,9 @@ var interfaceModel = function (_baseModel) {
|
||||
key: 'getSchema',
|
||||
value: function getSchema() {
|
||||
return {
|
||||
title: { type: String, required: true },
|
||||
uid: { type: Number, required: true },
|
||||
path: { type: String, required: true, validate: {
|
||||
validator: function validator(v) {
|
||||
return v && v[0] !== '/';
|
||||
},
|
||||
message: '接口路径第一位不能是/'
|
||||
} },
|
||||
path: { type: String, required: true },
|
||||
method: { type: String, required: true },
|
||||
project_id: { type: Number, required: true },
|
||||
desc: String,
|
||||
@ -115,9 +111,9 @@ var interfaceModel = function (_baseModel) {
|
||||
}
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function list(group_id) {
|
||||
value: function list(project_id) {
|
||||
return this.model.find({
|
||||
group_id: group_id
|
||||
project_id: project_id
|
||||
}).exec();
|
||||
}
|
||||
}, {
|
||||
|
112
server_dist/models/node.js
Normal file
112
server_dist/models/node.js
Normal file
@ -0,0 +1,112 @@
|
||||
'use strict';
|
||||
|
||||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
||||
|
||||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _yapi = require('../yapi.js');
|
||||
|
||||
var _yapi2 = _interopRequireDefault(_yapi);
|
||||
|
||||
var _base = require('./base.js');
|
||||
|
||||
var _base2 = _interopRequireDefault(_base);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var nodeModel = function (_baseModel) {
|
||||
(0, _inherits3.default)(nodeModel, _baseModel);
|
||||
|
||||
function nodeModel() {
|
||||
(0, _classCallCheck3.default)(this, nodeModel);
|
||||
return (0, _possibleConstructorReturn3.default)(this, (nodeModel.__proto__ || (0, _getPrototypeOf2.default)(nodeModel)).apply(this, arguments));
|
||||
}
|
||||
|
||||
(0, _createClass3.default)(nodeModel, [{
|
||||
key: 'getName',
|
||||
value: function getName() {
|
||||
return 'node';
|
||||
}
|
||||
}, {
|
||||
key: 'getSchema',
|
||||
value: function getSchema() {
|
||||
return {
|
||||
uid: { type: Number, required: true },
|
||||
title: { type: String, required: true },
|
||||
content: { type: String, required: true },
|
||||
is_read: { type: Boolean, required: true },
|
||||
add_time: Number
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: 'save',
|
||||
value: function save(data) {
|
||||
var node = new this.model(data);
|
||||
return node.save();
|
||||
}
|
||||
}, {
|
||||
key: 'get',
|
||||
value: function get(id) {
|
||||
return this.model.findOne({
|
||||
_id: id
|
||||
}).exec();
|
||||
}
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function list(uid) {
|
||||
return this.model.find({
|
||||
uid: uid
|
||||
}).exec();
|
||||
}
|
||||
}, {
|
||||
key: 'listWithPaging',
|
||||
value: function listWithPaging(uid, page, limit) {
|
||||
page = parseInt(page);
|
||||
limit = parseInt(limit);
|
||||
return this.model.find({
|
||||
uid: uid
|
||||
}).skip((page - 1) * limit).limit(limit).exec();
|
||||
}
|
||||
}, {
|
||||
key: 'listCount',
|
||||
value: function listCount(uid) {
|
||||
return this.model.count({
|
||||
uid: uid
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function del(id) {
|
||||
return this.model.deleteOne({
|
||||
_id: id
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function up(id, data) {
|
||||
data.up_time = _yapi2.default.commons.time();
|
||||
return this.model.update({
|
||||
_id: id
|
||||
}, data, { runValidators: true });
|
||||
}
|
||||
}]);
|
||||
return nodeModel;
|
||||
}(_base2.default);
|
||||
|
||||
module.exports = nodeModel;
|
@ -51,9 +51,9 @@ var projectModel = function (_baseModel) {
|
||||
name: { type: String, required: true },
|
||||
basepath: { type: String, required: true, validate: {
|
||||
validator: function validator(v) {
|
||||
return v && v[v.length - 1] === '/';
|
||||
return v && v[0] === '/';
|
||||
},
|
||||
message: 'basepath字符串结尾必须是/'
|
||||
message: 'basepath必须是/开头'
|
||||
} },
|
||||
desc: String,
|
||||
group_id: { type: Number, required: true },
|
||||
|
@ -32,6 +32,10 @@ var _project = require('./controllers/project.js');
|
||||
|
||||
var _project2 = _interopRequireDefault(_project);
|
||||
|
||||
var _node = require('./controllers/node.js');
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var router = (0, _koaRouter2.default)();
|
||||
@ -52,6 +56,10 @@ var INTERFACE_CONFIG = {
|
||||
project: {
|
||||
prefix: '/project/',
|
||||
controller: _project2.default
|
||||
},
|
||||
node: {
|
||||
prefix: '/node/',
|
||||
controller: _node2.default
|
||||
}
|
||||
};
|
||||
|
||||
@ -92,6 +100,13 @@ createAction('interface', 'get', 'get', 'get');
|
||||
createAction('interface', 'up', 'post', 'up');
|
||||
createAction('interface', 'del', 'post', 'del');
|
||||
|
||||
//node
|
||||
createAction('node', 'add', 'post', 'add');
|
||||
createAction('node', 'get', 'get', 'get');
|
||||
createAction('node', 'list', 'get', 'list');
|
||||
createAction('node', 'del', 'post', 'del');
|
||||
createAction('node', 'up', 'post', 'up');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} controller controller_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user