From c619cc396ad5c4a188118a77eb2a4ba85a2fc34b Mon Sep 17 00:00:00 2001 From: Mariela Date: Sun, 28 Aug 2022 02:02:02 -0600 Subject: [PATCH] fix api --- api-gateway/src/app.controller.ts | 39 +++++------------------- api-gateway/src/app.service.ts | 49 +++++++------------------------ 2 files changed, 17 insertions(+), 71 deletions(-) diff --git a/api-gateway/src/app.controller.ts b/api-gateway/src/app.controller.ts index f6bf3ab0..5066563a 100644 --- a/api-gateway/src/app.controller.ts +++ b/api-gateway/src/app.controller.ts @@ -468,38 +468,7 @@ export class AppController { } - // #==== API Payment - - @Post('payment/createPayment') - createPayment( - @Body('date_payment') date_payment: Date, - @Body('mount') mount: number, - @Body('description') description: string, - @Body('period') period: string, - @Body('status') status: string, - @Body('user_id') user_id: string, - @Body('communty_id') communty_id: string, - ) { - return this.appService.createPayment( - date_payment, - mount, - description, - period, - status, - user_id, - communty_id, - ); - } - - @Get('payment/allPayments') - allPayments() { - return this.appService.allPayments(); - } - - @Get('payment/find/:dni') - findPayment(@Param('dni') paramPaymentDNI: string) { - return this.appService.findPayment(paramPaymentDNI); - } + // #==== API Reservation @@ -541,6 +510,12 @@ export class AppController { return this.appService.findReservations(community_id); } + + @Delete('reservation/deleteReservation/:id') + deleteReservation(@Param('id') id: string) { + return this.appService.deleteReservation(id); + } + // #==== API Post diff --git a/api-gateway/src/app.service.ts b/api-gateway/src/app.service.ts index 380e23d1..970b061e 100644 --- a/api-gateway/src/app.service.ts +++ b/api-gateway/src/app.service.ts @@ -571,45 +571,7 @@ export class AppService { .send(pattern, payload) .pipe(map((message: string) => ({ message }))); } - // ====================== PAYMENTS =============================== - - //POST parameter from API - createPayment( - date_payment: Date, - mount: number, - description: string, - period: string, - status: string, - user_id: string, - communty_id: string, - ) { - const pattern = { cmd: 'createPayment' }; - const payload = { - date_payment: date_payment, mount: mount, description: description, - period: period, status: status, user_id: user_id, communty_id: communty_id - }; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - - allPayments() { - const pattern = { cmd: 'findAllPayments' }; - const payload = {}; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - - //GET parameter from API - findPayment(paramPaymentId: string) { - const pattern = { cmd: 'findOnePayment' }; - const payload = { id: paramPaymentId }; - return this.clientPaymentApp - .send(pattern, payload) - .pipe(map((message: string) => ({ message }))); - } - + // ====================== RESERVATIONS =============================== //POST parameter from API @@ -652,6 +614,15 @@ export class AppService { .pipe(map((message: string) => ({ message }))); } + //DELETE parameter from API + deleteReservation(paramReservationId: string) { + const pattern = { cmd: 'removeReservation' }; + const payload = { id: paramReservationId }; + return this.clientReservationApp + .send(pattern, payload) + .pipe(map((message: string) => ({ message }))); + } + // ====================== POSTS =============================== //POST parameter from API