diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 5066563a..56c1252c 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -468,7 +468,7 @@ export class AppController { } - + // #==== API Reservation @@ -516,7 +516,7 @@ export class AppController { return this.appService.deleteReservation(id); } - + // #==== API Post @Post('post/createPost') @@ -529,6 +529,16 @@ export class AppController { return this.appService.createPost(post, date_entry, user_id, community_id); } + @Put('post/updatePost/:id') + updatePost( + @Param('id') id: string, + @Body('post') post: string, + @Body('user_id') user_id: string, + @Body('community_id') community_id: string, + ) { + return this.appService.updatePost(id, post, user_id, community_id); + } + @Get('post/allPosts') allPosts() { return this.appService.allPosts(); diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 970b061e..7677f6ba 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -540,7 +540,7 @@ export class AppService { const pattern = { cmd: 'createGuest' }; const payload = { name: name, last_name: last_name, dni: dni, number_plate: number_plate, phone: phone, - status: status,tenant_id:tenant_id, community_id:community_id,date_entry: date_entry + status: status, tenant_id: tenant_id, community_id: community_id, date_entry: date_entry }; return this.clientGuestApp .send(pattern, payload) @@ -571,17 +571,17 @@ export class AppService { .send(pattern, payload) .pipe(map((message: string) => ({ message }))); } - + // ====================== RESERVATIONS =============================== //POST parameter from API createReservation(date: string, time: string, status: string, - date_entry: Date, user_id: string, common_area_id: string, + date_entry: Date, user_id: string, common_area_id: string, common_area_name: string, community_id: string) { const pattern = { cmd: 'createReservation' }; const payload = { date: date, time: time, status: status, - date_entry: date_entry, user_id: user_id, common_area_id: common_area_id, + date_entry: date_entry, user_id: user_id, common_area_id: common_area_id, common_area_name: common_area_name, community_id: community_id }; return this.clientReservationApp @@ -638,6 +638,16 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + updatePost(id: string, post: string, user_id: string, community_id: string) { + const pattern = { cmd: 'updatePost' }; + const payload = { + post: post, id: id, user_id: user_id, community_id: community_id + }; + return this.clientPostApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + allPosts() { const pattern = { cmd: 'findAllPosts' }; const payload = {};