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()
|
@Controller()
|
||||||
export class UsersController {
|
export class UsersController {
|
||||||
constructor(private readonly userService: UsersService) {}
|
constructor(private readonly userService: UsersService) { }
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'createUser' })
|
@MessagePattern({ cmd: 'createUser' })
|
||||||
create(@Payload() user: UserDocument) {
|
create(@Payload() user: UserDocument) {
|
||||||
|
@ -117,6 +117,11 @@ export class UsersController {
|
||||||
return this.userService.deleteAdminSystem(user['id']);
|
return this.userService.deleteAdminSystem(user['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@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;
|
return num_house;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async changeStatus(id: string, status: string) {
|
||||||
|
return this.userModel.findOneAndUpdate({ _id: id }, {status: status}, {
|
||||||
|
new: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue