1
2
3
4
5
@BeforeInsert()
@BeforeUpdate()
async hashPassword() {
this.password = await bcrypt.hash(this.password, 12);
}