[Bug 23893] New: Add ->new_from_api and ->set_from_api methods to Koha::Object
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Bug ID: 23893 Summary: Add ->new_from_api and ->set_from_api methods to Koha::Object Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Now we have ->to_api, we need to add the opposite operation, so: POST -> my $object = Koha::Class->new_from_api( $c->validation->param('body') )->store; PUT/PATCH -> my $object = Koha::Class->find( $c->validation->param('object_id') ); $object->set_from_api( $c->validation->param('body') )->store; -- 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=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | CC| |agustinmoyano@theke.io, | |jonathan.druart@bugs.koha-c | |ommunity.org, | |josef.moravec@gmail.com, | |kyle@bywatersolutions.com, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com Status|NEW |ASSIGNED Depends on| |23843 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23843 [Bug 23843] Make existing endpoints use Koha::Object(s)->to_api -- 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=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lari.taskula@hypernova.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95276 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95276&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95277 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95277&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95278 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95278&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 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=23893 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I want to hear your opinions, I'm not feeling comfortable with this, looking at cleaning Koha::REST::V1::Patrons with this makes me wonder if it is falling short. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95276|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95277|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95278|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95311 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95311&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95312 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95312&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95313 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95313&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95314 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95314&action=edit Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #9 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 95315 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=95315&action=edit Bug 23893: Use in /patrons This patch makes the patrons endpoint use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_20_05_target -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95311|0 |1 is obsolete| | --- Comment #10 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 96126 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96126&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95312|0 |1 is obsolete| | --- Comment #11 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 96127 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96127&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95313|0 |1 is obsolete| | --- Comment #12 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 96128 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96128&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95314|0 |1 is obsolete| | --- Comment #13 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 96129 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96129&action=edit Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #95315|0 |1 is obsolete| | --- Comment #14 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 96130 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96130&action=edit Bug 23893: Use in /patrons This patch makes the patrons endpoint use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Josef Moravec <josef.moravec@gmail.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=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24225 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24225 [Bug 24225] Add Koha::Objects->search_from_api method -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Please move attributes_from_api to a better please (not after AUTOLOAD). Before internals methods seems better (please amend the patch) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #16 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 96652 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96652&action=edit Bug 23893: No special care for booleans Tests pass without that changes. If we need them they should be at Koha::Object anyway. About the date, I also think that that should be moved to Koha::Object (we can guess it, like we do in Koha::Object->store, retrieve the datatype and adjust). Also we can send a DT object to DBIC, no need for an sql formatted date -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #17 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Do we really need the cache mechanism (_from_api_mapping)? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #18 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #17)
Do we really need the cache mechanism (_from_api_mapping)?
I'm not sure. My way of thinking was if someone needs it, we need to calculate it. And if for some reason the objects are passed around, it might be reused. But I'm not really sure. I would keep it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96128|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96129|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96130|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96652|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96126|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96127|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96655 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96655&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> 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=23893 --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96656 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96656&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> 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=23893 --- Comment #21 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96657 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96657&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> 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=23893 --- Comment #22 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96658 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96658&action=edit Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> 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=23893 --- Comment #23 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96659 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96659&action=edit Bug 23893: Use in /patrons This patch makes the patrons endpoint use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> 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=23893 --- Comment #24 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96660 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96660&action=edit Bug 23893: No special care for booleans Tests pass without that changes. If we need them they should be at Koha::Object anyway. About the date, I also think that that should be moved to Koha::Object (we can guess it, like we do in Koha::Object->store, retrieve the datatype and adjust). Also we can send a DT object to DBIC, no need for an sql formatted date 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=23893 --- Comment #25 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96661 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96661&action=edit Bug 23893: (QA follow-up) Explicit date format This patch makes the input date format explicit. It also adds a missing POD. 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=23893 --- Comment #26 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 96662 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96662&action=edit Bug 23893: Remove Overloaded method from Koha::Patron That way we are dealing with any date fields for any Koha::Object -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96662|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #27 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96665 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96665&action=edit Bug 23893: Remove Overloaded method from Koha::Patron That way we are dealing with any date fields for any Koha::Object -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #28 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96666 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96666&action=edit Bug 23893: Catch dt_from_string exceptions This patch adds exception handling to the attributes_from_api() method. This can happen with invalid date/datetimes, for example. Tests are added: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. 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=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24228 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24228 [Bug 24228] Add a parameter to recursively embed objects in Koha::Object(s)->to_api -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24321 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24321 [Bug 24321] Make objects.search use mappings from Koha::Object(s) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96655|0 |1 is obsolete| | Attachment #96656|0 |1 is obsolete| | Attachment #96657|0 |1 is obsolete| | Attachment #96658|0 |1 is obsolete| | Attachment #96659|0 |1 is obsolete| | Attachment #96660|0 |1 is obsolete| | Attachment #96661|0 |1 is obsolete| | Attachment #96665|0 |1 is obsolete| | Attachment #96666|0 |1 is obsolete| | --- Comment #29 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96920 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96920&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #30 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96921 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96921&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #31 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96922 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96922&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #32 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96923 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96923&action=edit Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #33 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96924 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96924&action=edit Bug 23893: Use in /patrons This patch makes the patrons endpoint use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #34 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96925 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96925&action=edit Bug 23893: No special care for booleans Tests pass without that changes. If we need them they should be at Koha::Object anyway. About the date, I also think that that should be moved to Koha::Object (we can guess it, like we do in Koha::Object->store, retrieve the datatype and adjust). Also we can send a DT object to DBIC, no need for an sql formatted date Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #35 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96926 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96926&action=edit Bug 23893: (QA follow-up) Explicit date format This patch makes the input date format explicit. It also adds a missing POD. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #36 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96927 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96927&action=edit Bug 23893: Remove Overloaded method from Koha::Patron That way we are dealing with any date fields for any Koha::Object Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #37 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96928 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96928&action=edit Bug 23893: Catch dt_from_string exceptions This patch adds exception handling to the attributes_from_api() method. This can happen with invalid date/datetimes, for example. Tests are added: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: John Doe <you@example.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96920|0 |1 is obsolete| | Attachment #96921|0 |1 is obsolete| | Attachment #96922|0 |1 is obsolete| | Attachment #96923|0 |1 is obsolete| | Attachment #96924|0 |1 is obsolete| | Attachment #96925|0 |1 is obsolete| | Attachment #96926|0 |1 is obsolete| | Attachment #96927|0 |1 is obsolete| | Attachment #96928|0 |1 is obsolete| | --- Comment #38 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96929 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96929&action=edit Bug 23893: Unit tests This patch introduces tests for the implemented methods. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #39 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96930 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96930&action=edit Bug 23893: Implement Koha::Object->from_api_mapping This patch implements the from_api_mapping method, that calculates (and caches) the reserve mapping from the to_api_mapping method. A generic to_api_mapping is added to simplify things a bit in the generic to_api method and so the mappings are reusable in the way they are in from_api_mapping. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #40 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96931 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96931&action=edit Bug 23893: Add new_from_api and set_from_api to Koha::Object This patch introduces the following methods to the Koha::Object class: - set_from_api - new_from_api This methods are going to be used when writing API controllers that map to the attributes to the DB schema ones. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #41 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96932 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96932&action=edit Bug 23893: Use in /cities This patch makes the cities controller use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/cities.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #42 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96933 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96933&action=edit Bug 23893: Use in /patrons This patch makes the patrons endpoint use the new methods from Koha::Object. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #43 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96934 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96934&action=edit Bug 23893: No special care for booleans Tests pass without that changes. If we need them they should be at Koha::Object anyway. About the date, I also think that that should be moved to Koha::Object (we can guess it, like we do in Koha::Object->store, retrieve the datatype and adjust). Also we can send a DT object to DBIC, no need for an sql formatted date Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #44 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96935 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96935&action=edit Bug 23893: (QA follow-up) Explicit date format This patch makes the input date format explicit. It also adds a missing POD. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #45 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96936 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96936&action=edit Bug 23893: Remove Overloaded method from Koha::Patron That way we are dealing with any date fields for any Koha::Object Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #46 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 96937 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96937&action=edit Bug 23893: Catch dt_from_string exceptions This patch adds exception handling to the attributes_from_api() method. This can happen with invalid date/datetimes, for example. Tests are added: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_20_05_target |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #47 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This development introduces release notes| |generic methods to deal | |with API-to-DB attribute | |names translations, and | |some data transformations | |(dates and booleans). | | | |With | |this design we can overload | |this methods to handle | |specific cases without | |repeating the code as we | |did on initial | |implementations of API | |controllers. | | | |Testing | |becomes easier as well. QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | --- Comment #48 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Thanks, Martin. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Architecture, internals, |REST API |and plumbing | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 --- Comment #49 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 97391 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97391&action=edit Bug 23893: Special care for booleans This patch acknowledges the fact that in D8 the Mojo::JSON->true and Mojo::JSON->false values don't translate into integers when passed to DBIC. It works correctly on D9 onwards, but we haven't formally deprecated Jessie. This is adding back this translation, in the right place now that all mappings code has been integrated into Koha::Object(s) directly. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Object.t => SUCCESS: Tests pass! 3. 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=23893 --- Comment #50 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Followup pushed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24432 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24432 [Bug 24432] Request an endpoint with a date column in order by throws bad parameter exception -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |joy@bywatersolutions.com Version(s)|20.05.00 |20.05.00, 19.11.02 released in| | --- Comment #51 from Joy Nelson <joy@bywatersolutions.com> --- Pushed to 19.11.x branch for 19.11.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #52 from Lucas Gass <lucas@bywatersolutions.com> --- enhancement will not be backported to 19.05.x series -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23893 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org