diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 3884c89a..5d2b9f92 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -128,6 +128,14 @@ export class AppController { return this.appService.deleteAdminSystem(id); } + @Post('user/changeStatus') + changeStatusUser( + @Body('id') pId: string, + @Body('status') pStatus: string, + ) { + return this.appService.changeStatusUser(pId, pStatus); + } + // #==== API Communities @Post('community/createCommunity') createCommunity( @@ -174,11 +182,11 @@ export class AppController { return this.appService.findCommunityAdmin(community_id); } @Post('community/changeStatus') - changeStatus( + changeStatusCommunity( @Body('id') pId: string, @Body('status') pStatus: string, ) { - return this.appService.changeStatus(pId, pStatus); + return this.appService.changeStatusCommunity(pId, pStatus); } // #==== API Common Areas @Post('commonArea/createCommonArea') diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 52c79492..d4a5c20b 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -18,7 +18,7 @@ export class AppService { @Inject('SERVICIO_REPORTES') private readonly clientReportApp: ClientProxy, @Inject('SERVICIO_NOTIFICACIONES') private readonly clientNotificationtApp: ClientProxy, - ) {} + ) { } // ====================== USERS =============================== @@ -79,7 +79,7 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } - + createAdminCommunity(dni: string, name: string, last_name: string, email: string, phone: number , user_type: string, status: string, date_entry: Date, community_id: string) { const pattern = { cmd: 'createAdminCommunity' }; @@ -128,7 +128,7 @@ export class AppService { map((message: string) => ({ message })), ); } - + //GET parameter from API findUser(paramUserDNI: string) { @@ -179,17 +179,10 @@ export class AppService { .send(pattern, payload) .pipe(map((message: string) => ({ message }))); } - changeStatus(pId: string, pStatus: string) { - const pattern = { cmd: 'changeStatus' }; - const payload = { id: pId, status: pStatus }; - return this.clientCommunityApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - //GET parameter from API - findUserById(id: string) { + //GET parameter from API + findUserById(id: string) { const pattern = { cmd: 'findById' }; const payload = { id: id }; return this.clientUserApp @@ -197,8 +190,23 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + changeStatusUser(pId: string, pStatus: string) { + const pattern = { cmd: 'changeStatus' }; + const payload = { id: pId, status: pStatus }; + return this.clientUserApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + // ====================== COMMUNITIES =============================== + changeStatusCommunity(pId: string, pStatus: string) { + const pattern = { cmd: 'changeStatus' }; + const payload = { id: pId, status: pStatus }; + return this.clientCommunityApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } //POST parameter from API createCommunity(name: string, province: string, canton: string, district: string @@ -285,8 +293,8 @@ export class AppService { } - //GET parameter from API - findByCommunity(paramCommunityId: string) { + //GET parameter from API + findByCommunity(paramCommunityId: string) { const pattern = { cmd: 'findByCommunity' }; const payload = { community_id: paramCommunityId }; return this.clientCommonAreaApp @@ -295,14 +303,14 @@ export class AppService { } - //DELETE parameter from API - deleteCommonArea(paramCommonAreaId: string) { - const pattern = { cmd: 'removeCommonArea' }; - const payload = { id: paramCommonAreaId }; - return this.clientCommonAreaApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } + //DELETE parameter from API + deleteCommonArea(paramCommonAreaId: string) { + const pattern = { cmd: 'removeCommonArea' }; + const payload = { id: paramCommonAreaId }; + return this.clientCommonAreaApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } // ====================== GUESTS ===============================