change status en service

This commit is contained in:
Mariela 2022-08-19 00:04:11 -06:00
parent 99064e9a4d
commit bf2c9b374a
2 changed files with 14 additions and 0 deletions

View File

@ -39,4 +39,12 @@ export class CommonAreasController {
let _community_id = id['community_id']; let _community_id = id['community_id'];
return this.commonAreasService.findByCommunity(_community_id); return this.commonAreasService.findByCommunity(_community_id);
} }
//cambiar de estado
@MessagePattern({ cmd: 'changeStatus' })
changeStatus(@Payload() body: string) {
let pid = body['id'];
let pstatus = body['status'];
return this.commonAreasService.changeStatus(pid,pstatus);
}
} }

View File

@ -41,4 +41,10 @@ export class CommonAreasService {
return this.commonAreaModel.find({ community_id: community_id }).exec(); return this.commonAreaModel.find({ community_id: community_id }).exec();
} }
async changeStatus(id: string, status: string) {
return this.commonAreaModel.findOneAndUpdate({ _id: id }, {status: status}, {
new: true,
});
}
} }