agregar funciones en servicio de usuarios

This commit is contained in:
Mariela 2022-08-02 21:50:01 -06:00
parent ca19da1d19
commit e2f0b401c5
2 changed files with 12 additions and 2 deletions

View File

@ -118,5 +118,10 @@ export class UsersController {
}
@MessagePattern({ cmd: 'changeStatus' })
changeStatus(@Payload() body: string) {
let pid = body['id'];
let pstatus = body['status'];
return this.userService.changeStatus(pid, pstatus);
}
}

View File

@ -223,5 +223,10 @@ export class UsersService {
return num_house;
}
async changeStatus(id: string, status: string) {
return this.userModel.findOneAndUpdate({ _id: id }, {status: status}, {
new: true,
});
}
}