mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
33 lines
538 B
JavaScript
33 lines
538 B
JavaScript
import yapi from '../yapi.js'
|
|
const groupSchema = ({
|
|
uid: String,
|
|
group_name: String,
|
|
group_desc: String,
|
|
add_time: Number,
|
|
up_time: Number
|
|
})
|
|
|
|
|
|
var groupModel = yapi.db('group', groupSchema);
|
|
|
|
|
|
function save(data){
|
|
let 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
|
|
}
|