Summary: | Clean GET /patrons controller | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | REST API | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart, kyle, martin.renvoize |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
21.05.00
|
|
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 27855 | ||
Attachments: |
Bug 27854: Clean GET /patrons controller
Bug 27854: Clean GET /patrons controller Bug 27854: Clean GET /patrons controller |
Description
Tomás Cohen Arazi (tcohen)
2021-03-03 19:35:11 UTC
Created attachment 117624 [details] [review] Bug 27854: Clean GET /patrons controller The controller method was written a lot of time before the enhancements we added to the objects.search helper, and it is now much easier to handle the 'restricted' param use case. No need to do it like that anymore. This patch fetches the 'restricted' param from the query parameters and cleans it from the validated data, so we can just pass the resultset to $c->objects->search as in all other controllers. And we had tests for the expected behavior, so testing this is as easy as: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! Of course! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 117655 [details] [review] Bug 27854: Clean GET /patrons controller The controller method was written a lot of time before the enhancements we added to the objects.search helper, and it is now much easier to handle the 'restricted' param use case. No need to do it like that anymore. This patch fetches the 'restricted' param from the query parameters and cleans it from the validated data, so we can just pass the resultset to $c->objects->search as in all other controllers. And we had tests for the expected behavior, so testing this is as easy as: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! Of course! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Created attachment 117675 [details] [review] Bug 27854: Clean GET /patrons controller The controller method was written a lot of time before the enhancements we added to the objects.search helper, and it is now much easier to handle the 'restricted' param use case. No need to do it like that anymore. This patch fetches the 'restricted' param from the query parameters and cleans it from the validated data, so we can just pass the resultset to $c->objects->search as in all other controllers. And we had tests for the expected behavior, so testing this is as easy as: 1. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests still pass! Of course! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Nice bit of tidying up here.. great to see how far the API infrastructure has come. Works as expected, tests all pass, QA script happy. Passing QA Pushed to master for 21.05, thanks to everybody involved! Enhancement not pushed to 20.11.x |