add plumbing to delete tenant
This commit is contained in:
		
							parent
							
								
									25344faca0
								
							
						
					
					
						commit
						11aff885e7
					
				|  | @ -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( | ||||||
|  |  | ||||||
|  | @ -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 }; | ||||||
|  |  | ||||||
|  | @ -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) { | ||||||
|  |  | ||||||
|  | @ -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, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue