Skip to content

Commit

Permalink
Bug 36120: Add pickup_library support to bookings API
Browse files Browse the repository at this point in the history
Sponsored-by: Cuyahoga County Public Library
Signed-off-by: Lisette Scheer <[email protected]>
Signed-off-by: Kristi Krueger <[email protected]>
Signed-off-by: Nick Clemens <[email protected]>
Signed-off-by: Katrin Fischer <[email protected]>
  • Loading branch information
mrenvoize authored and kfischer committed May 3, 2024
1 parent b3fa250 commit dadabbd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
13 changes: 13 additions & 0 deletions Koha/Booking.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions api/v1/swagger/definitions/booking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +48,7 @@ required:
- biblio_id
- item_id
- patron_id
- pickup_library_id
- start_date
- end_date
type: object
6 changes: 4 additions & 2 deletions api/v1/swagger/paths/biblios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
enum:
- item
- patron
- pickup_library
collectionFormat: csv
consumes:
- application/json
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -812,7 +814,7 @@
- integer
- "null"
required:
- rating
- rating
additionalProperties: false
produces:
- application/json
Expand Down
3 changes: 2 additions & 1 deletion api/v1/swagger/paths/bookings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- biblio
- item
- patron
- pickup_library
collectionFormat: csv
produces:
- application/json
Expand Down Expand Up @@ -121,7 +122,7 @@
permissions:
circulate: manage_bookings
x-mojo-to: Bookings#add
'/bookings/{booking_id}':
"/bookings/{booking_id}":
delete:
operationId: deleteBooking
parameters:
Expand Down

0 comments on commit dadabbd

Please sign in to comment.