Bugzilla – Attachment 175162 Details for
Bug 38291
Add GET /library_groups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38291: Add an endpoint to list library groups
Bug-38291-Add-an-endpoint-to-list-library-groups.patch (text/plain), 8.19 KB, created by
Matt Blenkinsop
on 2024-12-04 10:23:04 UTC
(
hide
)
Description:
Bug 38291: Add an endpoint to list library groups
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-12-04 10:23:04 UTC
Size:
8.19 KB
patch
obsolete
>From a2483163787f20ff4bf28dd56097a502106e6970 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Tue, 29 Oct 2024 16:59:51 +0000 >Subject: [PATCH] Bug 38291: Add an endpoint to list library groups > >(cherry picked from commit cd2440165f62e96410df9d11bb3aab578d028016) >--- > Koha/REST/V1/LibraryGroups.pm | 54 ++++++++++ > api/v1/swagger/definitions/library_group.yaml | 70 ++++++++++++ > api/v1/swagger/paths/library_groups.yaml | 101 ++++++++++++++++++ > api/v1/swagger/swagger.yaml | 4 + > 4 files changed, 229 insertions(+) > create mode 100644 Koha/REST/V1/LibraryGroups.pm > create mode 100644 api/v1/swagger/definitions/library_group.yaml > create mode 100644 api/v1/swagger/paths/library_groups.yaml > >diff --git a/Koha/REST/V1/LibraryGroups.pm b/Koha/REST/V1/LibraryGroups.pm >new file mode 100644 >index 00000000000..60038022e54 >--- /dev/null >+++ b/Koha/REST/V1/LibraryGroups.pm >@@ -0,0 +1,54 @@ >+package Koha::REST::V1::LibraryGroups; >+ >+# 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::Library::Groups; >+ >+use Scalar::Util qw( blessed ); >+ >+use Try::Tiny qw( catch try ); >+ >+=head1 NAME >+ >+Koha::REST::V1::LibraryGroups - Koha REST API for handling library groups (V1) >+ >+=head1 API >+ >+=head2 Methods >+ >+=cut >+ >+=head3 list >+ >+Controller function that handles listing Koha::Library::Group objects >+ >+=cut >+ >+sub list { >+ my $c = shift->openapi->valid_input or return; >+ >+ return try { >+ my $library_groups = $c->objects->search( Koha::Library::Groups->new ); >+ return $c->render( status => 200, openapi => $library_groups ); >+ } catch { >+ $c->unhandled_exception($_); >+ }; >+} >+ >+1; >diff --git a/api/v1/swagger/definitions/library_group.yaml b/api/v1/swagger/definitions/library_group.yaml >new file mode 100644 >index 00000000000..67ec6e2bed1 >--- /dev/null >+++ b/api/v1/swagger/definitions/library_group.yaml >@@ -0,0 +1,70 @@ >+--- >+type: object >+properties: >+ id: >+ type: string >+ description: internally assigned library group identifier >+ maxLength: 10 >+ minLength: 1 >+ title: >+ type: >+ - string >+ - "null" >+ description: Title of the library group >+ branchcode: >+ type: >+ - string >+ - "null" >+ description: Branchcode in the library group >+ description: >+ type: >+ - string >+ - "null" >+ description: the description of the library >+ parent_id: >+ type: >+ - integer >+ - "null" >+ description: identifier for the parent group >+ ft_hide_patron_info: >+ type: boolean >+ description: ft_hide_patron_info >+ ft_limit_item_editing: >+ type: boolean >+ description: ft_limit_item_editing >+ ft_search_groups_opac: >+ type: boolean >+ description: ft_search_groups_opac >+ ft_search_groups_staff: >+ type: boolean >+ description: ft_search_groups_staff >+ ft_local_hold_group: >+ type: boolean >+ description: ft_local_hold_group >+ ft_local_float_group: >+ type: boolean >+ description: ft_local_float_group >+ ft_acquisitions: >+ type: boolean >+ description: ft_acquisitions >+ created_on: >+ description: date of creation >+ type: >+ - string >+ - "null" >+ updated_on: >+ description: date of update >+ type: >+ - string >+ - "null" >+additionalProperties: false >+required: >+ - id >+ - title >+ - ft_limit_item_editing >+ - ft_search_groups_opac >+ - ft_search_groups_staff >+ - ft_local_hold_group >+ - ft_local_float_group >+ - ft_acquisitions >+ >diff --git a/api/v1/swagger/paths/library_groups.yaml b/api/v1/swagger/paths/library_groups.yaml >new file mode 100644 >index 00000000000..b47d8a321c8 >--- /dev/null >+++ b/api/v1/swagger/paths/library_groups.yaml >@@ -0,0 +1,101 @@ >+--- >+/library_groups: >+ get: >+ x-mojo-to: LibraryGroups#list >+ operationId: listLibraryGroups >+ tags: >+ - library_groups >+ summary: List library groups >+ parameters: >+ - name: parent_id >+ in: query >+ description: Identifier for the parent group >+ required: false >+ type: integer >+ - name: branchcode >+ in: query >+ description: Branchcode included in the group >+ required: false >+ type: string >+ - name: title >+ in: query >+ description: title of the library group >+ required: false >+ type: string >+ - name: description >+ in: query >+ description: description of the library group >+ required: false >+ type: string >+ - name: ft_hide_patron_info >+ in: query >+ description: search on ft_hide_patron_info >+ required: false >+ type: integer >+ - name: ft_limit_item_editing >+ in: query >+ description: search on ft_limit_item_editing >+ required: false >+ type: integer >+ - name: ft_search_groups_opac >+ in: query >+ description: search on ft_search_groups_opac >+ required: false >+ type: integer >+ - name: ft_search_groups_staff >+ in: query >+ description: search on ft_search_groups_staff >+ required: false >+ type: integer >+ - name: ft_local_hold_group >+ in: query >+ description: search on ft_local_hold_group >+ required: false >+ type: integer >+ - name: ft_local_float_group >+ in: query >+ description: search on ft_local_float_group >+ required: false >+ type: integer >+ - name: ft_acquisitions >+ in: query >+ description: search on ft_acquisitions >+ required: false >+ type: integer >+ - $ref: "../swagger.yaml#/parameters/match" >+ - $ref: "../swagger.yaml#/parameters/order_by" >+ - $ref: "../swagger.yaml#/parameters/page" >+ - $ref: "../swagger.yaml#/parameters/per_page" >+ - $ref: "../swagger.yaml#/parameters/q_param" >+ - $ref: "../swagger.yaml#/parameters/q_body" >+ - $ref: "../swagger.yaml#/parameters/request_id_header" >+ produces: >+ - application/json >+ responses: >+ "200": >+ description: A list of library groups >+ schema: >+ type: array >+ items: >+ $ref: "../swagger.yaml#/definitions/library_group" >+ "400": >+ description: | >+ Bad request. Possible `error_code` attribute values: >+ >+ * `invalid_query` >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "500": >+ description: | >+ Internal server error. Possible `error_code` attribute values: >+ >+ * `internal_server_error` >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "503": >+ description: Under maintenance >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ x-koha-authorization: >+ permissions: >+ catalogue: "1" >\ No newline at end of file >diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml >index ff7b94a174e..ba99365baa2 100644 >--- a/api/v1/swagger/swagger.yaml >+++ b/api/v1/swagger/swagger.yaml >@@ -132,6 +132,8 @@ definitions: > $ref: ./definitions/job.yaml > library: > $ref: ./definitions/library.yaml >+ library_group: >+ $ref: ./definitions/library_group.yaml > list: > $ref: ./definitions/list.yaml > merge_biblios: >@@ -445,6 +447,8 @@ paths: > $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1cash_registers" > "/libraries/{library_id}/desks": > $ref: "./paths/libraries.yaml#/~1libraries~1{library_id}~1desks" >+ /library_groups: >+ $ref: ./paths/library_groups.yaml#/~1library_groups > "/oauth/login/{provider_code}/{interface}": > $ref: ./paths/oauth.yaml#/~1oauth~1login~1{provider_code}~1{interface} > /oauth/token: >-- >2.39.3 (Apple Git-146)
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 38291
: 175162 |
175163