From 09f774a5dbc919bb694a98f3976d2323dc96e986 Mon Sep 17 00:00:00 2001 From: Mariela Date: Mon, 1 Aug 2022 00:37:05 -0600 Subject: [PATCH] add function findByCommunity en api gateway --- api-gateway/src/app.controller.ts | 5 +++++ api-gateway/src/app.service.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 20a6ee27..53442500 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -191,6 +191,11 @@ export class AppController { return this.appService.findCommonArea(paramCommonAreaId); } + @Get('commonArea//findByCommunity/:community_id') + findByCommunity(@Param('community_id') paramCommunityId: string) { + return this.appService.findByCommunity(paramCommunityId); + } + // #==== 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 4b71002b..426764c0 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -248,6 +248,16 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + + //GET parameter from API + findByCommunity(paramCommunityId: string) { + const pattern = { cmd: 'findByCommunity' }; + const payload = { community_id: paramCommunityId }; + return this.clientCommonAreaApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + // ====================== GUESTS =============================== //POST parameter from API