diff --git a/Koha/REST/V1/Bookings.pm b/Koha/REST/V1/Bookings.pm index 44e381ef1b..945614cd90 100644 --- a/Koha/REST/V1/Bookings.pm +++ b/Koha/REST/V1/Bookings.pm @@ -77,6 +77,7 @@ sub add { return try { my $booking = Koha::Booking->new_from_api( $c->req->json ); $booking->store; + $booking->discard_changes; $c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id ); return $c->render( status => 201, @@ -118,6 +119,7 @@ sub update { return try { $booking->set_from_api( $c->req->json ); $booking->store(); + $booking->discard_changes; return $c->render( status => 200, openapi => $c->objects->to_api($booking) ); } catch { $c->unhandled_exception($_); diff --git a/api/v1/swagger/definitions/booking.yaml b/api/v1/swagger/definitions/booking.yaml index 34a4ab2852..b40330dcd5 100644 --- a/api/v1/swagger/definitions/booking.yaml +++ b/api/v1/swagger/definitions/booking.yaml @@ -12,6 +12,7 @@ properties: type: integer creation_date: description: Creation date and time of this booking + readOnly: true format: date-time type: string end_date: @@ -30,6 +31,7 @@ properties: - 'null' modification_date: description: Modification date and time of this booking + readOnly: true format: date-time type: string patron_id: