From ec69fd23f6fb81e8f82a3847e3b73f02c8030177 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 4 Nov 2021 09:10:48 -0300 Subject: [PATCH] hotfix - Fix addToCommunity and getcommunityData endpoint Signed-off-by: Arthur --- src/mapas/mapas.controller.ts | 2 +- src/mapas/mapas.service.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mapas/mapas.controller.ts b/src/mapas/mapas.controller.ts index cfd954f..76ec5b2 100644 --- a/src/mapas/mapas.controller.ts +++ b/src/mapas/mapas.controller.ts @@ -90,7 +90,7 @@ export class MapasController { } @MessagePattern('getCommunityData') - async getCommunityData(@Payload('id') communityId: string) { + async getCommunityData(@Payload() communityId: string) { return this.mapasService.getCommunityData(communityId); } } diff --git a/src/mapas/mapas.service.ts b/src/mapas/mapas.service.ts index bac1ee0..46d3054 100644 --- a/src/mapas/mapas.service.ts +++ b/src/mapas/mapas.service.ts @@ -74,7 +74,6 @@ export class MapasService { private async getPoint(id: string) { const point = await this.pointModel.findById(id); - if (!point) throw new MicrosserviceException( 'Ponto não encontrada', @@ -272,7 +271,6 @@ export class MapasService { found = null; } } - return found; } @@ -323,12 +321,10 @@ export class MapasService { const relations = await this.communityRelationModel.find({ communityId: communityId, }); - for (const relation of relations) { const locationObject = await this.getPointOrAreaWithMedia( - relation.communityId, + relation.locationId, ); - if (locationObject instanceof PointDto) { communityDataDto.points.push(locationObject); }