Bugzilla – Attachment 91457 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.97 KB, created by
Michal Denar
on 2019-07-11 07:52:52 UTC
(
hide
)
Description:
Bug 22613: Add /patrons/{patron_id}/checkouts endpoint to REST API
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2019-07-11 07:52:52 UTC
Size:
3.97 KB
patch
obsolete
>From f9e3f322e967b8cd07ae7219fcb904a2927823ac 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> >Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> >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 5d544f5c5e..5e29b8ed07 100644 >--- a/api/v1/swagger/paths.json >+++ b/api/v1/swagger/paths.json >@@ -59,6 +59,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 ca6d970dbb..1b42c7bf50 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 5a3447412e..5aaf7e4c75 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 => 93; >+use Test::More tests => 102; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -152,6 +152,16 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&_per_pag > ->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) > ->json_hasnt('/1'); > >+$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