Bug 27366

Summary: Add GET /patrons/:patron_id/holds
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: andrew, fridolin.somers, jonathan.druart, lucas, m.de.rooy, martin.renvoize, oleonard
Version: Main   
Hardware: All   
OS: All   
URL: https://wiki.koha-community.org/wiki/Patrons_holds_endpoint_RFC
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancements adds the `GET /patrons/{patron_id}/holds` endpoint to the REST API.
Version(s) released in:
21.05.00,20.11.04
Circulation function:
Attachments: Bug 27366: Spec changes
Bug 27366: Unit tests
Bug 27366: Add controller
Bug 27366: Spec changes
Bug 27366: Unit tests
Bug 27366: Add controller
Bug 27366: Spec changes
Bug 27366: Unit tests
Bug 27366: Add controller
Bug 27366: Spec changes
Bug 27366: Unit tests
Bug 27366: Add controller

Description Tomás Cohen Arazi (tcohen) 2021-01-08 16:15:29 UTC
It would be handy to have, for rendering patron's holds tables.
Comment 1 Tomás Cohen Arazi (tcohen) 2021-01-08 16:19:03 UTC
Created attachment 114971 [details] [review]
Bug 27366: Spec changes
Comment 2 Tomás Cohen Arazi (tcohen) 2021-01-08 16:19:06 UTC
Created attachment 114972 [details] [review]
Bug 27366: Unit tests
Comment 3 Tomás Cohen Arazi (tcohen) 2021-01-08 16:19:10 UTC
Created attachment 114973 [details] [review]
Bug 27366: Add controller
Comment 4 Tomás Cohen Arazi (tcohen) 2021-01-08 16:21:35 UTC
Test plan:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_holds.t
=> SUCCESS: Tests pass
3. Try the route with your favorite REST tool
4. Sign off :-D
Comment 5 Lucas Gass (lukeg) 2021-01-08 23:22:12 UTC
Created attachment 114980 [details] [review]
Bug 27366: Spec changes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 6 Lucas Gass (lukeg) 2021-01-08 23:22:16 UTC
Created attachment 114981 [details] [review]
Bug 27366: Unit tests

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 Lucas Gass (lukeg) 2021-01-08 23:22:20 UTC
Created attachment 114982 [details] [review]
Bug 27366: Add controller

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Lucas Gass (lukeg) 2021-01-08 23:22:46 UTC
This is handy! The route works good when I test with PostMan.
Tests pass, thanks Tomas.
Comment 9 Marcel de Rooy 2021-01-29 10:41:57 UTC
Created attachment 116015 [details] [review]
Bug 27366: Spec changes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 10 Marcel de Rooy 2021-01-29 10:42:00 UTC
Created attachment 116016 [details] [review]
Bug 27366: Unit tests

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2021-01-29 10:42:04 UTC
Created attachment 116017 [details] [review]
Bug 27366: Add controller

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Jonathan Druart 2021-02-12 11:33:10 UTC
git log on these 3 patches:

Bug 27366: Spec changes
Bug 27366: Unit tests
Bug 27366: Add controller

Please add more info to the commit messages.
Comment 13 Martin Renvoize (ashimema) 2021-02-22 10:42:17 UTC
Created attachment 117135 [details] [review]
Bug 27366: Spec changes

Add /api/v1/patrons/{patron_id}/holds route and holds object description
to the OpenAPI specification.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize (ashimema) 2021-02-22 10:42:21 UTC
Created attachment 117136 [details] [review]
Bug 27366: Unit tests

Addd unit tests for the new patrons/{patron_id}/holds api route.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize (ashimema) 2021-02-22 10:42:24 UTC
Created attachment 117137 [details] [review]
Bug 27366: Add controller

Add a patron holds controller for the REST api and impliment the #list
methods.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize (ashimema) 2021-02-22 10:43:56 UTC
Amended the commit messages to get this one moving again.. and added a text for release notes.

Back to PQA
Comment 17 Jonathan Druart 2021-03-03 16:05:58 UTC
Can you update the wiki page please?

(In reply to Tomás Cohen Arazi from comment #0)
> It would be handy to have, for rendering patron's holds tables.

So you had in mind reserves AND old_reserves?
What would be a route for hold's history?
Comment 18 Tomás Cohen Arazi (tcohen) 2021-03-03 16:59:51 UTC
(In reply to Jonathan Druart from comment #17)
> Can you update the wiki page please?
> 
> (In reply to Tomás Cohen Arazi from comment #0)
> > It would be handy to have, for rendering patron's holds tables.
> 
> So you had in mind reserves AND old_reserves?
> What would be a route for hold's history?

My idea was that once bug 25260 got pushed, we could easily add a query param (like include_completed=1) to retrieve all of them.
Comment 19 Martin Renvoize (ashimema) 2021-03-03 18:21:09 UTC
And rebasing then testing bug 25260 is next on my list :-)
Comment 20 Jonathan Druart 2021-03-04 08:48:49 UTC
Waiting for the update of the wiki RFC page.
Comment 21 Tomás Cohen Arazi (tcohen) 2021-03-08 19:22:10 UTC
(In reply to Jonathan Druart from comment #20)
> Waiting for the update of the wiki RFC page.

Done.
Comment 22 Jonathan Druart 2021-03-16 15:10:51 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 23 Fridolin Somers 2021-03-22 09:23:33 UTC
Applies on 20.11, I choose to backport.

Pushed to 20.11.x for 20.11.04
Comment 24 Andrew Fuerste-Henry 2021-03-23 18:49:15 UTC
Enhancement. Not backporting to 20.05.