添加查询和创建角色功能;建立长连接后返回部分初始数据

This commit is contained in:
liangtongchuan
2020-09-01 22:15:31 +08:00
parent 2617efa6ad
commit dbdb11692c
23 changed files with 466 additions and 145 deletions
+5 -5
View File
@@ -3,13 +3,13 @@ import { prop, pre } from '@typegoose/typegoose';
/**
* BaseModel
*/
@pre<BaseModel>('save', function (next) {
@pre<BaseModel>('save', function(next) {
if (!this.createdAt || this.isNew) {
this.createdAt = this.updatedAt = new Date()
this.createdAt = this.updatedAt = new Date();
} else {
this.updatedAt = new Date()
this.updatedAt = new Date();
}
next()
next();
})
export default class BaseModel {
@@ -21,4 +21,4 @@ export default class BaseModel {
@prop()
updatedAt: Date
}
}