From 20bf65e94673c7e0520ab96d3a7d4f4f205656e5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Feb 2022 16:52:30 +0100 Subject: [PATCH] Bug 32030: ERM - Koha::REST::V1::ERM::Agreements Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/ERM/Agreements.pm | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Koha/REST/V1/ERM/Agreements.pm diff --git a/Koha/REST/V1/ERM/Agreements.pm b/Koha/REST/V1/ERM/Agreements.pm new file mode 100644 index 0000000000..f521ca6916 --- /dev/null +++ b/Koha/REST/V1/ERM/Agreements.pm @@ -0,0 +1,48 @@ +package Koha::REST::V1::ERM::Agreements; + +# 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 . + +use Modern::Perl; + +use Mojo::Base 'Mojolicious::Controller'; + +use Koha::ERM::Agreements; + +use Try::Tiny qw( catch try ); + +=head1 API + +=head2 Methods + +=head3 list + +=cut + +sub list { + my $c = shift->openapi->valid_input or return; + + return try { + my $agreements_set = Koha::ERM::Agreements->new; + my $agreements = $c->objects->search( $agreements_set ); + return $c->render( status => 200, openapi => $agreements ); + } + catch { + $c->unhandled_exception($_); + }; + +} + +1; -- 2.39.5