agregar funciones en servicio de usuarios
This commit is contained in:
parent
ca19da1d19
commit
e2f0b401c5
|
@ -6,7 +6,7 @@ import { MongoExceptionFilter } from 'src/MongoExceptionFilter';
|
|||
|
||||
@Controller()
|
||||
export class UsersController {
|
||||
constructor(private readonly userService: UsersService) {}
|
||||
constructor(private readonly userService: UsersService) { }
|
||||
|
||||
@MessagePattern({ cmd: 'createUser' })
|
||||
create(@Payload() user: UserDocument) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue