Bugzilla – Attachment 94517 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
0001-Bug-22613-Add-patrons-patron_id-checkouts-endpoint-t.patch (text/plain), 4.02 KB, created by
Emmi Takkinen
on 2019-10-22 08:55:43 UTC
(
hide
)
Description:
Bug 22613: Add /patrons/{patron_id}/checkouts endpoint to REST API
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2019-10-22 08:55:43 UTC
Size:
4.02 KB
patch
obsolete
>From f9568a01fccc46bd9bd61a3fc068bd3249510c57 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> >Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.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 d705760f63..20baf263ac 100644 >--- a/api/v1/swagger/paths.json >+++ b/api/v1/swagger/paths.json >@@ -68,6 +68,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.17.1 >
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