Changing creation of reservation to always save a reservation and instead delete when it has been reserved

This commit is contained in:
Collin Duncan 2023-08-10 13:34:23 +02:00
parent fd5d059992
commit 56d1095f1f
No known key found for this signature in database

View file

@ -57,9 +57,9 @@ export class ReservationsController {
}), }),
) )
async createReservation(@Body() reservation: Reservation) { async createReservation(@Body() reservation: Reservation) {
await this.reservationsService.create(reservation)
if (!reservation.isAvailableForReservation()) { if (!reservation.isAvailableForReservation()) {
this.loggerService.debug('Reservation not available for reservation') this.loggerService.debug('Reservation not available for reservation')
await this.reservationsService.create(reservation)
return 'Reservation saved' return 'Reservation saved'
} }
this.loggerService.debug('Reservation is available for reservation') this.loggerService.debug('Reservation is available for reservation')