Bugzilla – Attachment 145281 Details for
Bug 30979
Add ability for OPAC users to checkout to themselves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30979: Add public items lookup route
Bug-30979-Add-public-items-lookup-route.patch (text/plain), 4.07 KB, created by
Martin Renvoize (ashimema)
on 2023-01-13 15:53:59 UTC
(
hide
)
Description:
Bug 30979: Add public items lookup route
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-01-13 15:53:59 UTC
Size:
4.07 KB
patch
obsolete
>From d26581706f648f1585f32d128d321328c1eaae79 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 19 Jul 2022 11:56:56 +0100 >Subject: [PATCH] Bug 30979: Add public items lookup route > >This patch adds a /public equivilent to the item listing endpoint. > >This allows us to search for an item by it's external_id (barcode). > >Test plan >1. Apply patch >2. Perform a GET on /api/v1/public/items?external_id=some_barcode >3. Confirm that the above enpoint correctly returns items that should > be visible in the OPAC >--- > Koha/REST/V1/Items.pm | 27 +++++++++++++++++ > api/v1/swagger/paths/items.yaml | 51 +++++++++++++++++++++++++++++++++ > api/v1/swagger/swagger.yaml | 2 ++ > 3 files changed, 80 insertions(+) > >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index 515fcd91bfe..e42133ee0a2 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -58,6 +58,33 @@ sub list { > }; > } > >+=head3 list_public >+ >+Controller function that handles listing Koha::Item objects available to the opac >+ >+=cut >+ >+sub list_public { >+ my $c = shift->openapi->valid_input or return; >+ >+ return try { >+ my $patron = $c->stash('koha.user'); >+ >+ my $items_set = >+ Koha::Items->filter_by_visible_in_opac( { patron => $patron } ); >+ my $items = $c->objects->search($items_set); >+ >+ # ->filter_by_visible_in_opac( { patron => $patron } ); >+ >+ return $c->render( >+ status => 200, >+ openapi => $items >+ ); >+ } >+ catch { >+ $c->unhandled_exception($_); >+ }; >+} > > =head3 get > >diff --git a/api/v1/swagger/paths/items.yaml b/api/v1/swagger/paths/items.yaml >index 7c947f6e3fb..7b6017acfb7 100644 >--- a/api/v1/swagger/paths/items.yaml >+++ b/api/v1/swagger/paths/items.yaml >@@ -316,3 +316,54 @@ > x-koha-authorization: > permissions: > reserveforothers: place_holds >+"/public/items": >+ get: >+ x-mojo-to: Items#list_public >+ operationId: listItemsPublic >+ tags: >+ - items >+ summary: List items publically visible >+ parameters: >+ - name: external_id >+ in: query >+ description: Search on the item's barcode >+ required: false >+ type: string >+ - $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/q_header" >+ - $ref: "../swagger.yaml#/parameters/request_id_header" >+ consumes: >+ - application/json >+ produces: >+ - application/json >+ responses: >+ "200": >+ description: A list of item >+ schema: >+ type: array >+ items: >+ $ref: "../swagger.yaml#/definitions/item" >+ "401": >+ description: Authentication required >+ schema: >+ $ref: "../swagger.yaml#/definitions/error" >+ "403": >+ description: Access forbidden >+ 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" >diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml >index 696a73be8b4..4869bebe472 100644 >--- a/api/v1/swagger/swagger.yaml >+++ b/api/v1/swagger/swagger.yaml >@@ -273,6 +273,8 @@ paths: > $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date" > "/public/biblios/{biblio_id}": > $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}" >+ "/public/items": >+ $ref: "./paths/items.yaml#/~1public~1items" > "/public/biblios/{biblio_id}/items": > $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}~1items" > "/public/biblios/{biblio_id}/ratings": >-- >2.39.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 30979
:
139131
|
139132
|
139133
|
139134
|
141274
|
141275
|
141276
|
141277
|
141278
|
141279
|
141300
|
145264
|
145265
|
145266
|
145267
|
145268
|
145277
|
145280
|
145281
|
145282
|
145283
|
145284
|
145285
|
145620
|
145621
|
145622
|
145623
|
145624
|
145625
|
145626
|
145627
|
145628
|
145629
|
145630
|
150867
|
150868
|
150869
|
150870
|
150871
|
150872
|
150873
|
150874
|
150875
|
150876
|
150877
|
150878
|
150879
|
150880
|
150881
|
150882
|
150883
|
150884
|
150885
|
150886
|
150887
|
150888
|
150889
|
150967
|
150968
|
150969
|
150970
|
150971
|
150972
|
150973
|
150974
|
151254
|
151255
|
151256
|
151257
|
151258
|
151259
|
151260
|
151261
|
151358
|
151359
|
151360
|
151361
|
151362
|
151363
|
151364
|
151365
|
151368
|
151369
|
151370
|
151371
|
151372
|
151373
|
151374
|
151375
|
151376
|
152789
|
152790
|
152791
|
152792
|
152793
|
152794
|
152795
|
152796
|
152797
|
153459
|
153460
|
153461
|
153462
|
153463
|
153464
|
153465
|
153466
|
153467
|
153500
|
153501
|
153502
|
153503