diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 56c1252c..dbcd8b85 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -425,6 +425,23 @@ export class AppController { return this.appService.changeStatusCommonArea(pId, pStatus); } + @Post('commonArea/updateCommonArea') + updateCommonArea( + @Body('_id') id: string, + @Body('name') name: string, + @Body('hourMin') hourMin: string, + @Body('hourMax') hourMax: string, + @Body('bookable') bookable: number, + @Body('community_id') community_id: string, + ) { + return this.appService.updateCommonArea( + id, + name, + hourMin, + hourMax, + bookable, + community_id,); + } // #==== API GUEST //#API userService - create user @Post('guest/createGuest') diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 7677f6ba..56eb67e6 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -522,7 +522,27 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } - + updateCommonArea( + id: string, + name: string, + hourMin: string, + hourMax: string, + bookable: number, + community_id: string, + ) { + const pattern = { cmd: 'updateCommonArea' }; + const payload = { + id: id, + name: name, + hourMin: hourMin, + hourMax: hourMax, + bookable: bookable, + community_id: community_id, + }; + return this.clientCommonAreaApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } // ====================== GUESTS =============================== //POST parameter from API diff --git a/servicio-areas-comunes/src/common_areas/common_areas.service.ts b/servicio-areas-comunes/src/common_areas/common_areas.service.ts index 877bd011..b25a9d5f 100644 --- a/servicio-areas-comunes/src/common_areas/common_areas.service.ts +++ b/servicio-areas-comunes/src/common_areas/common_areas.service.ts @@ -26,6 +26,7 @@ export class CommonAreasService { } update(id: string, commonArea: CommonAreaDocument) { + console.log(commonArea); return this.commonAreaModel.findOneAndUpdate({ _id: id }, commonArea, { new: true, }); diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 6da1739d..b8c2b0f9 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -166,7 +166,7 @@ const AreasComunes = () => { }, }) .then(function (response) { - if (response.status != 201) + if (response.status != 201 && response.status != 200) console.log('OcurriĆ³ un error con el servicio: ' + response.status); else return response.json(); })