diff --git a/servicio-usuarios/src/users/users.service.ts b/servicio-usuarios/src/users/users.service.ts index 4a9c2441..37b379a0 100644 --- a/servicio-usuarios/src/users/users.service.ts +++ b/servicio-usuarios/src/users/users.service.ts @@ -72,7 +72,7 @@ export class UsersService { ); } - async resetUserPassword(user: UserDocument){ + async resetUserPassword(user: UserDocument) { let passwordEncriptada = Md5.init(user.password); user.password = passwordEncriptada; return this.userModel.findOneAndUpdate({ _id: user._id }, { password: passwordEncriptada }, { @@ -84,7 +84,7 @@ export class UsersService { const pattern = { cmd: 'findOneCommunity' } const payload = { _id: community_id } - let callback = await this.clientCommunityApp + let callback = this.clientCommunityApp .send(pattern, payload) .pipe( map((response: string) => ({ response })) @@ -114,8 +114,8 @@ export class UsersService { async updateAdminSystem(id: string, user: UserDocument) { return this.userModel.findOneAndUpdate({ _id: id }, { name: user['name'], last_name: user['last_name'], - dni:user['dni'], email: user['email'], phone: user['phone'] - }, { + dni: user['dni'], email: user['email'], phone: user['phone'] + }, { new: true, }); } @@ -212,7 +212,7 @@ export class UsersService { } async deleteAdminSystem(id: string) { - return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1'}, { + return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1' }, { new: true, }); } @@ -225,13 +225,13 @@ export class UsersService { async deleteTenant(tenant_id: string, community_id: string, number_house: string) { - try{ - await this.userModel.findOneAndUpdate({ _id: tenant_id }, { status: '-1', number_house:''}, { + try { + await this.userModel.findOneAndUpdate({ _id: tenant_id }, { status: '-1', number_house: '' }, { new: true, }); - + return await this.deleteTenantNumHouse(community_id, number_house, tenant_id); - } catch(error){ + } catch (error) { console.log(error) return error; }