Bug 36100: Remove readOnly from bookings definition.

Whilst readOnly feels correct here, swagger doesn't work that way at our
version. It must be removed to restore the ability to edit exising
bookings.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e8a2f4df73)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2024-02-15 10:15:12 +00:00 committed by Fridolin Somers
parent 16d3402cfe
commit b051e53bc9
2 changed files with 8 additions and 2 deletions

View File

@ -83,7 +83,7 @@ sub add {
$c->res->headers->location( $c->req->url->to_string . '/' . $booking->booking_id );
return $c->render(
status => 201,
openapi => $c->objects->to_api( $booking ),
openapi => $c->objects->to_api($booking),
);
} catch {
if ( blessed $_ and $_->isa('Koha::Exceptions::Booking::Clash') ) {
@ -91,6 +91,13 @@ sub add {
status => 400,
openapi => { error => "Booking would conflict" }
);
} elsif ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) {
return $c->render(
status => 400,
openapi => {
error => "Duplicate booking_id",
}
);
}
return $c->unhandled_exception($_);

View File

@ -10,7 +10,6 @@ properties:
booking_id:
description: Internal booking identifier
type: integer
readOnly: true
end_date:
description: Start date and time of this booking
format: date-time