From dadabbd92403af8128c6d538679f05810cda1ab0 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Mar 2024 17:12:51 +0000 Subject: [PATCH] Bug 36120: Add pickup_library support to bookings API Sponsored-by: Cuyahoga County Public Library Signed-off-by: Lisette Scheer Signed-off-by: Kristi Krueger Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- Koha/Booking.pm | 13 +++++++++++++ api/v1/swagger/definitions/booking.yaml | 9 +++++++++ api/v1/swagger/paths/biblios.yaml | 6 ++++-- api/v1/swagger/paths/bookings.yaml | 3 ++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Koha/Booking.pm b/Koha/Booking.pm index 65d3122b6e..f1004ae1f7 100644 --- a/Koha/Booking.pm +++ b/Koha/Booking.pm @@ -58,6 +58,19 @@ sub patron { return Koha::Patron->_new_from_dbic($patron_rs); } +=head3 pickup_library + +Returns the related Koha::Library object for this booking + +=cut + +sub pickup_library { + my ($self) = @_; + + my $pickup_library_rs = $self->_result->pickup_library; + return Koha::Library->_new_from_dbic($pickup_library_rs); +} + =head3 item Returns the related Koha::Item object for this Booking diff --git a/api/v1/swagger/definitions/booking.yaml b/api/v1/swagger/definitions/booking.yaml index 23393a60ff..aed1e31b3f 100644 --- a/api/v1/swagger/definitions/booking.yaml +++ b/api/v1/swagger/definitions/booking.yaml @@ -32,6 +32,14 @@ properties: type: - object - "null" + pickup_library_id: + description: Internal pickup_library identifier + type: string + pickup_library: + description: Embedable pickup_library representation + type: + - object + - "null" start_date: description: Start date and time of this booking format: date-time @@ -40,6 +48,7 @@ required: - biblio_id - item_id - patron_id + - pickup_library_id - start_date - end_date type: object diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index f41a08363e..2da90e27d6 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -300,6 +300,7 @@ enum: - item - patron + - pickup_library collectionFormat: csv consumes: - application/json @@ -373,7 +374,8 @@ collectionFormat: csv - name: checked_in in: query - description: By default, current checkouts are returned, when this is true then + description: + By default, current checkouts are returned, when this is true then checked in checkouts are returned as result. type: boolean produces: @@ -812,7 +814,7 @@ - integer - "null" required: - - rating + - rating additionalProperties: false produces: - application/json diff --git a/api/v1/swagger/paths/bookings.yaml b/api/v1/swagger/paths/bookings.yaml index f7bb0b8804..35a50a3410 100644 --- a/api/v1/swagger/paths/bookings.yaml +++ b/api/v1/swagger/paths/bookings.yaml @@ -46,6 +46,7 @@ - biblio - item - patron + - pickup_library collectionFormat: csv produces: - application/json @@ -121,7 +122,7 @@ permissions: circulate: manage_bookings x-mojo-to: Bookings#add -'/bookings/{booking_id}': +"/bookings/{booking_id}": delete: operationId: deleteBooking parameters: -- 2.39.5