obtener inquilinos api
This commit is contained in:
		
							parent
							
								
									e34fb7d5cc
								
							
						
					
					
						commit
						72ea9d2033
					
				| 
						 | 
					@ -77,6 +77,7 @@ export class AppController {
 | 
				
			||||||
  allUsersAdminComunidad() {
 | 
					  allUsersAdminComunidad() {
 | 
				
			||||||
    return this.appService.allUsersAdminComunidad();
 | 
					    return this.appService.allUsersAdminComunidad();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Get('user/findGuards/:community')
 | 
					  @Get('user/findGuards/:community')
 | 
				
			||||||
  findGuardsCommunity(
 | 
					  findGuardsCommunity(
 | 
				
			||||||
    @Param('community_id') community_id: string
 | 
					    @Param('community_id') community_id: string
 | 
				
			||||||
| 
						 | 
					@ -84,6 +85,11 @@ export class AppController {
 | 
				
			||||||
    return this.appService.findGuardsCommunity(community_id);
 | 
					    return this.appService.findGuardsCommunity(community_id);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Get('user/findTenants')
 | 
				
			||||||
 | 
					  allUsersTenants() {
 | 
				
			||||||
 | 
					    return this.appService.allUsersTenants();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  @Get('user/find/:dni')
 | 
					  @Get('user/find/:dni')
 | 
				
			||||||
  findUser(
 | 
					  findUser(
 | 
				
			||||||
    @Param('dni') paramUserDNI: string
 | 
					    @Param('dni') paramUserDNI: string
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,6 +95,17 @@ export class AppService {
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  allUsersTenants() {
 | 
				
			||||||
 | 
					    const pattern = { cmd: 'findTenants' };
 | 
				
			||||||
 | 
					    const payload = {};
 | 
				
			||||||
 | 
					    return this.clientUserApp
 | 
				
			||||||
 | 
					      .send<string>(pattern, payload)
 | 
				
			||||||
 | 
					      .pipe(
 | 
				
			||||||
 | 
					        map((message: string) => ({ message })),
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //GET parameter from API
 | 
					  //GET parameter from API
 | 
				
			||||||
  findUser(paramUserDNI: string) {
 | 
					  findUser(paramUserDNI: string) {
 | 
				
			||||||
    const pattern = { cmd: 'findUserDNI' };
 | 
					    const pattern = { cmd: 'findUserDNI' };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,18 @@ export class UsersController {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @MessagePattern({ cmd: 'findTenantsCommunity' })
 | 
				
			||||||
 | 
					  findTenantsCommunity(@Payload() community_id: string) {
 | 
				
			||||||
 | 
					    let pcommunity_id = community_id['community_id'];
 | 
				
			||||||
 | 
					    return this.userService.findTenantsCommunity(pcommunity_id);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @MessagePattern({ cmd: 'findTenants' })
 | 
				
			||||||
 | 
					  findTenants() {
 | 
				
			||||||
 | 
					    return this.userService.findTenants();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @MessagePattern({ cmd: 'updateUser' })
 | 
					  @MessagePattern({ cmd: 'updateUser' })
 | 
				
			||||||
  update(@Payload() user: UserDocument) {
 | 
					  update(@Payload() user: UserDocument) {
 | 
				
			||||||
    return this.userService.update(user.id, user);
 | 
					    return this.userService.update(user.id, user);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,6 +88,17 @@ export class UsersService {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  //find inquilinos
 | 
				
			||||||
 | 
					  async findTenants(): Promise<User[]> {
 | 
				
			||||||
 | 
					    return this.userModel.find({ user_type: 3 }).exec();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  //find inquilinos
 | 
				
			||||||
 | 
					  async findTenantsCommunity(pcommunity_id: string): Promise<User[]> {
 | 
				
			||||||
 | 
					    return this.userModel.find({ community_id: pcommunity_id, user_type: 4 }).exec();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async testSendMail(user: UserDocument) {
 | 
					  async testSendMail(user: UserDocument) {
 | 
				
			||||||
    let passwordEncriptada = Md5.init(user.password);
 | 
					    let passwordEncriptada = Md5.init(user.password);
 | 
				
			||||||
    user.password = passwordEncriptada;
 | 
					    user.password = passwordEncriptada;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue