Bugzilla – Attachment 88332 Details for
Bug 22613
Add /patrons/patron_id/checkouts endpoints
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22613: Add /patrons/{patron_id}/checkouts endpoint to REST API
Bug-22613-Add-patronspatronidcheckouts-endpoint-to.patch (text/plain), 3.86 KB, created by
Michal Denar
on 2019-04-18 19:39:04 UTC
(
hide
)
Description:
Bug 22613: Add /patrons/{patron_id}/checkouts endpoint to REST API
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2019-04-18 19:39:04 UTC
Size:
3.86 KB
patch
obsolete
>From 0ef9985abb56b4403fcd71ba1db11998ccfa2d02 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 1 Apr 2019 12:08:53 +0000 >Subject: [PATCH] Bug 22613: Add /patrons/{patron_id}/checkouts endpoint to > REST API > >Test plan: >1) Apply the patch >2) Restart plack >3) Access GET to /patrons/{patron_id}/checkouts >It should have the same abilities as /checkouts?patron_id={patron_id} >4) prove t/db_dependent/api/v1/checkouts.t > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > api/v1/swagger/paths.json | 4 ++++ > api/v1/swagger/paths/checkouts.json | 39 +++++++++++++++++++++++++++++++++++++ > t/db_dependent/api/v1/checkouts.t | 12 +++++++++++- > 3 files changed, 54 insertions(+), 1 deletion(-) > >diff --git a/api/v1/swagger/paths.json b/api/v1/swagger/paths.json >index 605430996b..20b2e13755 100644 >--- a/api/v1/swagger/paths.json >+++ b/api/v1/swagger/paths.json >@@ -56,6 +56,10 @@ > "/patrons/{patron_id}/account/credits": { > "$ref": "paths/patrons_account.json#/~1patrons~1{patron_id}~1account~1credits" > }, >+ "/patrons/{patron_id}/checkouts": { >+ "$ref": "paths/checkouts.json#/~1patrons~1{patron_id}~1checkouts" >+ }, >+ > "/patrons/{patron_id}/password": { > "$ref": "paths/patrons_password.json#/~1patrons~1{patron_id}~1password" > }, >diff --git a/api/v1/swagger/paths/checkouts.json b/api/v1/swagger/paths/checkouts.json >index faa6f65828..53a9964012 100644 >--- a/api/v1/swagger/paths/checkouts.json >+++ b/api/v1/swagger/paths/checkouts.json >@@ -135,5 +135,44 @@ > } > } > } >+ }, >+ "/patrons/{patron_id}/checkouts": { >+ "get": { >+ "x-mojo-to": "Checkouts#list", >+ "operationId": "listPatronsCheckouts", >+ "tags": ["patrons", "checkouts"], >+ "parameters": [{ >+ "$ref": "../parameters.json#/patron_id_pp" >+ },{ >+ "name": "checked_in", >+ "in": "query", >+ "description": "By default, only current checkout are returned, when this is true, all checkouts (current and checked in) are returned as result.", >+ "type": "boolean" >+ }], >+ "produces": [ >+ "application/json" >+ ], >+ "responses": { >+ "200": { >+ "description": "A list of checkouts", >+ "schema": { >+ "$ref": "../definitions.json#/checkouts" >+ } >+ }, >+ "403": { >+ "description": "Access forbidden", >+ "schema": { "$ref": "../definitions.json#/error" } >+ }, >+ "404": { >+ "description": "Patron not found", >+ "schema": { "$ref": "../definitions.json#/error" } >+ } >+ }, >+ "x-koha-authorization": { >+ "permissions": { >+ "circulate": "circulate_remaining_permissions" >+ } >+ } >+ } > } > } >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index 75f2c6a331..0fb7f3fb72 100644 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 73; >+use Test::More tests => 82; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -130,6 +130,16 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id") > ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) > ->json_hasnt('/2'); > >+$t->get_ok( "//$userid:$password@/api/v1/patrons/$patron_id/checkouts") >+ ->status_is(200) >+ ->json_is('/0/patron_id' => $patron_id) >+ ->json_is('/0/item_id' => $item1->itemnumber) >+ ->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due1 }) ) >+ ->json_is('/1/patron_id' => $patron_id) >+ ->json_is('/1/item_id' => $item2->itemnumber) >+ ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) >+ ->json_hasnt('/2'); >+ > $t->get_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id) > ->status_is(200) > ->json_is('/patron_id' => $patron_id) >-- >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 22613
:
87276
|
88148
|
88266
|
88332
|
88448
|
88450
|
91406
|
91457
|
94517
|
164611
|
164759
|
164770