change status en service
This commit is contained in:
parent
99064e9a4d
commit
bf2c9b374a
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue