修改代码格式;

数据库查询加 lean 判断;
其它内容微调。
This commit is contained in:
liangtongchuan
2020-08-27 20:01:35 +08:00
parent 940879016f
commit c53db8634d
17 changed files with 710 additions and 323 deletions

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
}
}