This commit is contained in:
Mariela 2022-08-28 02:02:02 -06:00
parent 2ff3db6615
commit c619cc396a
2 changed files with 17 additions and 71 deletions

View File

@ -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

View File

@ -571,45 +571,7 @@ export class AppService {
.send<string>(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<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
allPayments() {
const pattern = { cmd: 'findAllPayments' };
const payload = {};
return this.clientPaymentApp
.send<string>(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<string>(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<string>(pattern, payload)
.pipe(map((message: string) => ({ message })));
}
// ====================== POSTS ===============================
//POST parameter from API