clean up,

tests,
fixes
This commit is contained in:
2018-06-01 01:06:00 +03:00
parent db46f1a2b4
commit 2f48681944
11 changed files with 277 additions and 71 deletions

View File

@@ -22,8 +22,15 @@ UserSchema.plugin(passportLocalMongoose);
UserSchema.plugin(uniqueValidator);
UserSchema.pre('remove', async function () {
await this.model('TodoList').remove({ user: this._id });
await this.model('Todo').remove({ user: this._id });
await this.model('TodoList')
.find({ user: this._id })
.remove()
.exec();
await this.model('Todo')
.find({ user: this._id })
.remove()
.exec();
});
UserSchema.methods.generateJwt = function () {