yapi/server_dist/controllers/interfaceCol.js

143 lines
4.9 KiB
JavaScript
Raw Normal View History

'use strict';
2017-08-08 19:47:36 +08:00
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 _interfaceCol = require('../models/interfaceCol.js');
var _interfaceCol2 = _interopRequireDefault(_interfaceCol);
var _base = require('./base.js');
var _base2 = _interopRequireDefault(_base);
var _yapi = require('../yapi.js');
var _yapi2 = _interopRequireDefault(_yapi);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var interfaceColController = function (_baseController) {
(0, _inherits3.default)(interfaceColController, _baseController);
function interfaceColController(ctx) {
(0, _classCallCheck3.default)(this, interfaceColController);
var _this = (0, _possibleConstructorReturn3.default)(this, (interfaceColController.__proto__ || (0, _getPrototypeOf2.default)(interfaceColController)).call(this, ctx));
_this.Model = _yapi2.default.getInst(_interfaceCol2.default);
return _this;
}
(0, _createClass3.default)(interfaceColController, [{
key: 'list',
2017-08-08 19:47:36 +08:00
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',
2017-08-08 19:47:36 +08:00
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',
2017-08-08 19:47:36 +08:00
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);