mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
38 lines
698 B
JavaScript
38 lines
698 B
JavaScript
'use strict';
|
|
|
|
var _yapi = require('../yapi.js');
|
|
|
|
var _yapi2 = _interopRequireDefault(_yapi);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var groupSchema = {
|
|
uid: String,
|
|
group_name: String,
|
|
group_desc: String,
|
|
add_time: Number,
|
|
up_time: Number
|
|
};
|
|
|
|
var groupModel = _yapi2.default.db('group', groupSchema);
|
|
|
|
function save(data) {
|
|
var m = new groupModel(data);
|
|
return m.save();
|
|
}
|
|
|
|
function checkRepeat(name) {
|
|
return groupModel.count({
|
|
group_name: name
|
|
});
|
|
}
|
|
|
|
function list() {
|
|
return groupModel.list().exec();
|
|
}
|
|
|
|
module.exports = {
|
|
save: save,
|
|
checkRepeat: checkRepeat,
|
|
list: list
|
|
}; |