feat: add login mutation

This commit is contained in:
Ali BARIN
2021-12-20 22:09:20 +01:00
parent 8b05489e40
commit e0f380026e
4 changed files with 50 additions and 1 deletions

View File

@@ -32,6 +32,10 @@ class User extends Base {
}
})
login(password: string) {
return bcrypt.compare(password, this.password);
}
async generateHash() {
this.password = await bcrypt.hash(this.password, 10);
}