Bugzilla – Attachment 114982 Details for
Bug 27366
Add GET /patrons/:patron_id/holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27366: Add controller
Bug-27366-Add-controller.patch (text/plain), 2.18 KB, created by
Lucas Gass (lukeg)
on 2021-01-08 23:22:20 UTC
(
hide
)
Description:
Bug 27366: Add controller
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2021-01-08 23:22:20 UTC
Size:
2.18 KB
patch
obsolete
>From 096e64350677d76b4e1649174cd9979a67d1745f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 8 Jan 2021 13:16:35 -0300 >Subject: [PATCH] Bug 27366: Add controller > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > Koha/REST/V1/Patrons/Holds.pm | 67 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > create mode 100644 Koha/REST/V1/Patrons/Holds.pm > >diff --git a/Koha/REST/V1/Patrons/Holds.pm b/Koha/REST/V1/Patrons/Holds.pm >new file mode 100644 >index 0000000000..370e13a201 >--- /dev/null >+++ b/Koha/REST/V1/Patrons/Holds.pm >@@ -0,0 +1,67 @@ >+package Koha::REST::V1::Patrons::Holds; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Mojo::Base 'Mojolicious::Controller'; >+ >+use Koha::Patrons; >+ >+=head1 NAME >+ >+Koha::REST::V1::Patrons::Holds >+ >+=head1 API >+ >+=head2 Methods >+ >+=head3 list >+ >+Controller function that handles listing Koha::Hold objects for the requested patron >+ >+=cut >+ >+sub list { >+ my $c = shift->openapi->valid_input or return; >+ >+ my $patron = Koha::Patrons->find( $c->validation->param('patron_id') ); >+ >+ unless ( $patron ) { >+ return $c->render( >+ status => 404, >+ openapi => { >+ error => 'Patron not found' >+ } >+ ); >+ } >+ >+ return try { >+ >+ my $holds_rs = $patron->holds; >+ my $holds = $c->objects->search( $holds_rs ); >+ >+ return $c->render( >+ status => 200, >+ openapi => $holds >+ ); >+ } >+ catch { >+ $c->unhandled_exception($_); >+ }; >+} >+ >+1; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27366
:
114971
|
114972
|
114973
|
114980
|
114981
|
114982
|
116015
|
116016
|
116017
|
117135
|
117136
|
117137