add plumbing to delete tenant

This commit is contained in:
Eduardo Quiros 2022-08-21 04:35:59 -06:00
parent 25344faca0
commit 11aff885e7
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
4 changed files with 18 additions and 5 deletions

View File

@ -160,6 +160,10 @@ export class AppController {
return this.appService.deleteAdminCommunity(id); return this.appService.deleteAdminCommunity(id);
} }
@Delete('user/deleteTenant/:id')
deleteTenant(@Param('id') id: string) {
return this.appService.deleteTenant(id);
}
@Post('user/changeStatus') @Post('user/changeStatus')
changeStatusUser( changeStatusUser(

View File

@ -54,8 +54,8 @@ export class AppService {
} }
updateUser( updateUser(
dni: string, dni: string,
name: string, name: string,
last_name: string, last_name: string,
email: string, email: string,
phone: number, phone: number,
@ -201,6 +201,14 @@ export class AppService {
.pipe(map((message: string) => ({ message }))); .pipe(map((message: string) => ({ message })));
} }
deleteTenant(id: string) {
const pattern = { cmd: 'deleteTenant' };
const payload = { id: id };
return this.clientUserApp
.send<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
inicioSesion(pEmail: string, pPassword: string) { inicioSesion(pEmail: string, pPassword: string) {
const pattern = { cmd: 'loginUser' }; const pattern = { cmd: 'loginUser' };
const payload = { email: pEmail, password: pPassword }; const payload = { email: pEmail, password: pPassword };

View File

@ -115,13 +115,15 @@ export class UsersController {
return this.userService.deleteAdminSystem(user['id']); return this.userService.deleteAdminSystem(user['id']);
} }
@MessagePattern({ cmd: 'deleteAdminCommunity' }) @MessagePattern({ cmd: 'deleteAdminCommunity' })
deleteAdminCommunity(@Payload() user: any) { deleteAdminCommunity(@Payload() user: any) {
return this.userService.deleteAdminCommunity(user['id']); return this.userService.deleteAdminCommunity(user['id']);
} }
@MessagePattern({ cmd: 'deleteTenant' })
deleteTenant(@Payload() user: any) {
return this.userService.deleteTenant(user['id']);
}
@MessagePattern({ cmd: 'changeStatus' }) @MessagePattern({ cmd: 'changeStatus' })
changeStatus(@Payload() body: string) { changeStatus(@Payload() body: string) {

View File

@ -189,7 +189,6 @@ export class UsersService {
}); });
} }
deleteAdminCommunity(id: string) { deleteAdminCommunity(id: string) {
return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1' }, { return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1' }, {
new: true, new: true,