chore: client dev env path

This commit is contained in:
sean 2017-08-08 19:47:36 +08:00
parent 7e546f9c09
commit ef0475b66c
11 changed files with 111 additions and 579 deletions

View File

@ -101,7 +101,7 @@ gulp.task('initialBuild', ['removeDist'], () => {
});
excuteCmd('ykit', ['s', '-p', '4000'], {
cwd: path.resolve(__dirname, '../')
cwd: path.resolve(__dirname, './')
});
});
});

View File

@ -8,16 +8,23 @@ class interfaceColController extends baseController{
this.Model = yapi.getInst(interfaceColModel);
}
list(ctx){
async list(ctx){
try {
let id = ctx.query.project_id;
let inst = yapi.getInst(interfaceColModel);
let result = await inst.list(id);
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}
}
up(ctx){
async up(ctx){
}
del(ctx){
async del(ctx){
}

View File

@ -34,8 +34,10 @@ class interfaceCol extends baseModel {
});
}
list() {
return this.model.find().exec();
list(project_id) {
return this.model.find({
project_id: project_id
}).exec();
}
del(id) {

View File

@ -1 +0,0 @@
"use strict";

View File

@ -1,5 +1,13 @@
'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);
@ -48,13 +56,88 @@ var interfaceColController = function (_baseController) {
(0, _createClass3.default)(interfaceColController, [{
key: 'list',
value: function list(ctx) {}
value: function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
var id, inst, result;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
id = ctx.query.project_id;
inst = _yapi2.default.getInst(_interfaceCol2.default);
_context.next = 5;
return inst.list(id);
case 5:
result = _context.sent;
ctx.body = _yapi2.default.commons.resReturn(result);
_context.next = 12;
break;
case 9:
_context.prev = 9;
_context.t0 = _context['catch'](0);
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
case 12:
case 'end':
return _context.stop();
}
}
}, _callee, this, [[0, 9]]);
}));
function list(_x) {
return _ref.apply(this, arguments);
}
return list;
}()
}, {
key: 'up',
value: function up(ctx) {}
value: function () {
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
case 'end':
return _context2.stop();
}
}
}, _callee2, this);
}));
function up(_x2) {
return _ref2.apply(this, arguments);
}
return up;
}()
}, {
key: 'del',
value: function del(ctx) {}
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
case 'end':
return _context3.stop();
}
}
}, _callee3, this);
}));
function del(_x3) {
return _ref3.apply(this, arguments);
}
return del;
}()
}]);
return interfaceColController;
}(_base2.default);

View File

@ -1,153 +0,0 @@
'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 groupModel = function (_baseModel) {
(0, _inherits3.default)(groupModel, _baseModel);
function groupModel() {
(0, _classCallCheck3.default)(this, groupModel);
return (0, _possibleConstructorReturn3.default)(this, (groupModel.__proto__ || (0, _getPrototypeOf2.default)(groupModel)).apply(this, arguments));
}
(0, _createClass3.default)(groupModel, [{
key: 'getName',
value: function getName() {
return 'interface_col';
}
}, {
key: 'getSchema',
value: function getSchema() {
return {
uid: Number,
group_name: String,
group_desc: String,
add_time: Number,
up_time: Number,
members: [{
uid: Number,
role: { type: String, enum: ['owner', 'dev'] },
username: String,
email: String
}]
};
}
}, {
key: 'save',
value: function save(data) {
var m = new this.model(data);
return m.save();
}
}, {
key: 'get',
value: function get(id) {
return this.model.findOne({
_id: id
}).exec();
}
}, {
key: 'checkRepeat',
value: function checkRepeat(name) {
return this.model.count({
group_name: name
});
}
}, {
key: 'addMember',
value: function addMember(id, data) {
return this.model.update({
_id: id
}, {
$push: { members: data }
});
}
}, {
key: 'delMember',
value: function delMember(id, uid) {
return this.model.update({
_id: id
}, {
$pull: { members: { uid: uid } }
});
}
}, {
key: 'changeMemberRole',
value: function changeMemberRole(id, uid, role) {
return this.model.update({
_id: id,
"members.uid": uid
}, {
"$set": { "members.$.uid": role }
});
}
}, {
key: 'checkMemberRepeat',
value: function checkMemberRepeat(id, uid) {
return this.model.count({
_id: id,
"members.uid": uid
});
}
}, {
key: 'list',
value: function list() {
return this.model.find().select('group_name _id group_desc add_time up_time').exec();
}
}, {
key: 'del',
value: function del(id) {
return this.model.deleteOne({
_id: id
});
}
}, {
key: 'up',
value: function up(id, data) {
return this.model.update({
_id: id
}, {
group_name: data.group_name,
group_desc: data.group_desc,
up_time: _yapi2.default.commons.time()
});
}
}, {
key: 'search',
value: function search(keyword) {
return this.model.find({
group_name: new RegExp(keyword, 'i')
}).limit(10);
}
}]);
return groupModel;
}(_base2.default);
module.exports = groupModel;

View File

@ -1,153 +0,0 @@
'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 groupModel = function (_baseModel) {
(0, _inherits3.default)(groupModel, _baseModel);
function groupModel() {
(0, _classCallCheck3.default)(this, groupModel);
return (0, _possibleConstructorReturn3.default)(this, (groupModel.__proto__ || (0, _getPrototypeOf2.default)(groupModel)).apply(this, arguments));
}
(0, _createClass3.default)(groupModel, [{
key: 'getName',
value: function getName() {
return 'group';
}
}, {
key: 'getSchema',
value: function getSchema() {
return {
uid: Number,
group_name: String,
group_desc: String,
add_time: Number,
up_time: Number,
members: [{
uid: Number,
role: { type: String, enum: ['owner', 'dev'] },
username: String,
email: String
}]
};
}
}, {
key: 'save',
value: function save(data) {
var m = new this.model(data);
return m.save();
}
}, {
key: 'get',
value: function get(id) {
return this.model.findOne({
_id: id
}).exec();
}
}, {
key: 'checkRepeat',
value: function checkRepeat(name) {
return this.model.count({
group_name: name
});
}
}, {
key: 'addMember',
value: function addMember(id, data) {
return this.model.update({
_id: id
}, {
$push: { members: data }
});
}
}, {
key: 'delMember',
value: function delMember(id, uid) {
return this.model.update({
_id: id
}, {
$pull: { members: { uid: uid } }
});
}
}, {
key: 'changeMemberRole',
value: function changeMemberRole(id, uid, role) {
return this.model.update({
_id: id,
"members.uid": uid
}, {
"$set": { "members.$.uid": role }
});
}
}, {
key: 'checkMemberRepeat',
value: function checkMemberRepeat(id, uid) {
return this.model.count({
_id: id,
"members.uid": uid
});
}
}, {
key: 'list',
value: function list() {
return this.model.find().select('group_name _id group_desc add_time up_time').exec();
}
}, {
key: 'del',
value: function del(id) {
return this.model.deleteOne({
_id: id
});
}
}, {
key: 'up',
value: function up(id, data) {
return this.model.update({
_id: id
}, {
group_name: data.group_name,
group_desc: data.group_desc,
up_time: _yapi2.default.commons.time()
});
}
}, {
key: 'search',
value: function search(keyword) {
return this.model.find({
group_name: new RegExp(keyword, 'i')
}).limit(10);
}
}]);
return groupModel;
}(_base2.default);
module.exports = groupModel;

View File

@ -1,102 +0,0 @@
'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 interfaceCol = function (_baseModel) {
(0, _inherits3.default)(interfaceCol, _baseModel);
function interfaceCol() {
(0, _classCallCheck3.default)(this, interfaceCol);
return (0, _possibleConstructorReturn3.default)(this, (interfaceCol.__proto__ || (0, _getPrototypeOf2.default)(interfaceCol)).apply(this, arguments));
}
(0, _createClass3.default)(interfaceCol, [{
key: 'getName',
value: function getName() {
return 'interface_col';
}
}, {
key: 'getSchema',
value: function getSchema() {
return {
name: { type: String, required: true },
uid: { type: Number, required: true },
project_id: { type: Number, required: true },
desc: String,
add_time: Number,
up_time: Number
};
}
}, {
key: 'save',
value: function save(data) {
var m = new this.model(data);
return m.save();
}
}, {
key: 'get',
value: function get(id) {
return this.model.findOne({
_id: id
}).exec();
}
}, {
key: 'checkRepeat',
value: function checkRepeat(name) {
return this.model.count({
name: name
});
}
}, {
key: 'list',
value: function list() {
return this.model.find().exec();
}
}, {
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);
}
}]);
return interfaceCol;
}(_base2.default);
module.exports = groupModel;

View File

@ -77,8 +77,10 @@ var interfaceCol = function (_baseModel) {
}
}, {
key: 'list',
value: function list() {
return this.model.find().exec();
value: function list(project_id) {
return this.model.find({
project_id: project_id
}).exec();
}
}, {
key: 'del',

View File

@ -1,153 +0,0 @@
'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 groupModel = function (_baseModel) {
(0, _inherits3.default)(groupModel, _baseModel);
function groupModel() {
(0, _classCallCheck3.default)(this, groupModel);
return (0, _possibleConstructorReturn3.default)(this, (groupModel.__proto__ || (0, _getPrototypeOf2.default)(groupModel)).apply(this, arguments));
}
(0, _createClass3.default)(groupModel, [{
key: 'getName',
value: function getName() {
return 'interface_col';
}
}, {
key: 'getSchema',
value: function getSchema() {
return {
uid: Number,
group_name: String,
group_desc: String,
add_time: Number,
up_time: Number,
members: [{
uid: Number,
role: { type: String, enum: ['owner', 'dev'] },
username: String,
email: String
}]
};
}
}, {
key: 'save',
value: function save(data) {
var m = new this.model(data);
return m.save();
}
}, {
key: 'get',
value: function get(id) {
return this.model.findOne({
_id: id
}).exec();
}
}, {
key: 'checkRepeat',
value: function checkRepeat(name) {
return this.model.count({
group_name: name
});
}
}, {
key: 'addMember',
value: function addMember(id, data) {
return this.model.update({
_id: id
}, {
$push: { members: data }
});
}
}, {
key: 'delMember',
value: function delMember(id, uid) {
return this.model.update({
_id: id
}, {
$pull: { members: { uid: uid } }
});
}
}, {
key: 'changeMemberRole',
value: function changeMemberRole(id, uid, role) {
return this.model.update({
_id: id,
"members.uid": uid
}, {
"$set": { "members.$.uid": role }
});
}
}, {
key: 'checkMemberRepeat',
value: function checkMemberRepeat(id, uid) {
return this.model.count({
_id: id,
"members.uid": uid
});
}
}, {
key: 'list',
value: function list() {
return this.model.find().select('group_name _id group_desc add_time up_time').exec();
}
}, {
key: 'del',
value: function del(id) {
return this.model.deleteOne({
_id: id
});
}
}, {
key: 'up',
value: function up(id, data) {
return this.model.update({
_id: id
}, {
group_name: data.group_name,
group_desc: data.group_desc,
up_time: _yapi2.default.commons.time()
});
}
}, {
key: 'search',
value: function search(keyword) {
return this.model.find({
group_name: new RegExp(keyword, 'i')
}).limit(10);
}
}]);
return groupModel;
}(_base2.default);
module.exports = groupModel;

View File

@ -11,10 +11,10 @@
<script src="http://127.0.0.1:4000/yapi/prd/manifest@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/lib2@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/lib@dev.js"></script>
<script src="http://127.0.0.1:4000/yapi/prd/index@dev.js"></script>
<script src="http://127.0.0.1:4000/prd/manifest@dev.js"></script>
<script src="http://127.0.0.1:4000/prd/lib2@dev.js"></script>
<script src="http://127.0.0.1:4000/prd/lib@dev.js"></script>
<script src="http://127.0.0.1:4000/prd/index@dev.js"></script>
<script src="/lib/ace-1.2.8.js"></script>
<script src="/lib/snippets-json.js"></script>