add reset function to user service

This commit is contained in:
Eduardo Quiros 2022-08-23 21:49:00 -06:00
parent 8131d1c9fe
commit d13bdb5dd1
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,14 @@ export class UsersService {
);
}
async resetUserPassword(user: UserDocument){
let passwordEncriptada = Md5.init(user.password);
user.password = passwordEncriptada;
return this.userModel.findOneAndUpdate({ _id: user._id }, { password: passwordEncriptada }, {
new: true,
});
}
async findCommunity(community_id: string) {
const pattern = { cmd: 'findOneCommunity' }
const payload = { _id: community_id }