diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index 5d2b9f92..8a30ff9d 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common'; +import { Controller, Get, Post, Put, Body, Param, Delete } from '@nestjs/common'; import { AppService } from './app.service'; @Controller() export class AppController { @@ -80,6 +80,33 @@ export class AppController { ); } + @Put('user/updateUser/:dni') + updateUser(@Param('dni') dni: string) { + @Body('dni') dni: string, + @Body('name') name: string, + @Body('last_name') last_name: string, + @Body('email') email: string, + @Body('phone') phone: number, + @Body('password') password: string, + @Body('user_type') user_type: string, + @Body('status') status: string, + @Body('date_entry') date_entry: Date, + @Body('community_id') community_id: string, + ) { + return this.appService.createUser( + dni, + name, + last_name, + email, + phone, + password, + user_type, + status, + date_entry, + community_id, + ); + } + @Get('user/allUsers') allUsers() { return this.appService.allUsers(); diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index e1199d79..a5df9129 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -53,6 +53,36 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + updateUser( + dni: string, + name: string, + last_name: string, + email: string, + phone: number, + password: string, + user_type: string, + status: string, + date_entry: Date, + community_id: string, + ) { + const pattern = { cmd: 'updateUser' }; + const payload = { + dni: dni, + name: name, + last_name: last_name, + email: email, + phone: phone, + password: password, + user_type: user_type, + status: status, + date_entry: date_entry, + community_id: community_id, + }; + return this.clientUserApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + //POST parameter from API createAdminSystem(dni: string, name: string, last_name: string, email: string, phone: number , user_type: string, status: string, date_entry: Date) {