mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-03 04:50:32 +08:00
37 lines
658 B
JavaScript
Executable File
37 lines
658 B
JavaScript
Executable File
const yapi = require('../yapi.js');
|
|
const baseModel = require('./base.js');
|
|
|
|
class avatarModel extends baseModel {
|
|
getName() {
|
|
return 'avatar';
|
|
}
|
|
|
|
getSchema() {
|
|
return {
|
|
uid: { type: Number, required: true },
|
|
basecode: String,
|
|
type: String
|
|
};
|
|
}
|
|
|
|
get(uid) {
|
|
|
|
return this.model.findOne({
|
|
uid: uid
|
|
});
|
|
}
|
|
|
|
up(uid, basecode, type){
|
|
return this.model.update({
|
|
uid: uid
|
|
}, {
|
|
type: type,
|
|
basecode: basecode
|
|
},{
|
|
upsert: true
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = avatarModel; |