diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index a347f6b4..e8c51c72 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -654,4 +654,10 @@ export class AppController { html(@Body('email') email: string, @Body('name') name: string) { return this.appService.html(email, name); } + + @Get('reservation/findReservationUser/:id') + findReservationUser(@Param('id') paramComment: string) { + return this.appService.findReservationUser(paramComment); + } + } diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index dec53b6b..0213a277 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -823,8 +823,6 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } - - /* Function to generate combination of password */ generatePassword() { var pass = ''; @@ -841,8 +839,6 @@ export class AppService { return pass; } - - async saveTenantNumHouse(community_id: string, number_house: string, tenant_id: string) { const pattern = { cmd: 'saveTenantNumHouse' } @@ -855,4 +851,13 @@ export class AppService { ) } + + findReservationUser(paramGuestId: string) { + const pattern = { cmd: 'findReservationUser' }; + const payload = { id: paramGuestId }; + return this.clientReservationApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + } diff --git a/mobile-ui/App.js b/mobile-ui/App.js index f7b25e24..da04b65e 100644 --- a/mobile-ui/App.js +++ b/mobile-ui/App.js @@ -72,7 +72,7 @@ export default function App() { - { @@ -26,7 +28,7 @@ export default function Reservas({navigation}) { setIsRequesting(true); try { - const jsonResponse = await fetch(`${API.BASE_URL}/reservation/allReservations`, { + const jsonResponse = await fetch(`${API.BASE_URL}/reservation/findReservationUser/`+`${id}`, { method: "GET", headers: { 'Content-Type': 'application/json' diff --git a/servicio-reservaciones/package-lock.json b/servicio-reservaciones/package-lock.json index 37e3caca..9e9de38f 100644 --- a/servicio-reservaciones/package-lock.json +++ b/servicio-reservaciones/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "servicio-reservaciones", "version": "0.0.1", "license": "UNLICENSED", "dependencies": { diff --git a/servicio-reservaciones/src/reservations/reservations.controller.ts b/servicio-reservaciones/src/reservations/reservations.controller.ts index 5089ba2b..0195631d 100644 --- a/servicio-reservaciones/src/reservations/reservations.controller.ts +++ b/servicio-reservaciones/src/reservations/reservations.controller.ts @@ -50,4 +50,11 @@ export class ReservationsController { let community_id = reservation['community_id']; return this.reservationsService.removeIdCommunity(community_id); } + + @MessagePattern({ cmd: 'findReservationUser' }) + findReservationUser(@Payload() id: string) { + let _id = id['id']; + return this.reservationsService.findReservationUser(_id); + + } } diff --git a/servicio-reservaciones/src/reservations/reservations.service.ts b/servicio-reservaciones/src/reservations/reservations.service.ts index a7ab73d2..20b288bf 100644 --- a/servicio-reservaciones/src/reservations/reservations.service.ts +++ b/servicio-reservaciones/src/reservations/reservations.service.ts @@ -52,4 +52,9 @@ export class ReservationsService { async findReservationsByCommunity(community_id: string){ return this.reservationModel.find({ community_id: community_id }).exec(); } + + async findReservationUser(id: string): Promise { + return this.reservationModel.find({user_id:id}).setOptions({ sanitizeFilter: true }).exec(); + + } }