[Bug 27854] New: Clean GET /patrons controller
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Bug ID: 27854 Summary: Clean GET /patrons controller Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com The controller has a hardcoded version of objects.search and should be cleaned up, to gain superpowers and make it extendable. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27853 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27853 [Bug 27853] POST /patrons doesn't enforce mandatory extended attributes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 117624 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117624&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27855 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27855 [Bug 27855] Allow embedding extended_attributes on /patrons routes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117624|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 117655 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117655&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|27853 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27853 [Bug 27853] POST /patrons doesn't enforce mandatory extended attributes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #117655|0 |1 is obsolete| | --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 117675 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=117675&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #4 from 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 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |21.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 21.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27854 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- Enhancement not pushed to 20.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org