[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 --- Comment #9 from Tomás Cohen Arazi--- Created attachment 70626 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=70626=edit Bug 19686: (followup) Add to_api param for completeness This patch adds (yet) another param to objects.search: a reference to a to_api function to be applied when processing the search results for output. To test: - Apply this patch - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Test count raised, and tests pass! - Sign off :-D Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Blocks|19784 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19784 [Bug 19784] Adapt /v1/patrons to new naming guidelines -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Bug 19686 depends on bug 19410, which changed state. Bug 19410 Summary: Add a helper function for generating object searches for the API https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19410 What|Removed |Added Status|Pushed to Master|RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Blocks||19784 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19784 [Bug 19784] Adapt /v1/patrons to new naming guidelines -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Blocks||19757 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19757 [Bug 19757] Add routes to handle vendor contacts -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 --- Comment #8 from David Bourgault--- My bad. I tested again with a fresh BD and it worked. Test passed, QA tool green. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 David Bourgaultchanged: What|Removed |Added Attachment #69316|0 |1 is obsolete|| --- Comment #7 from David Bourgault --- Created attachment 69464 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69464=edit Bug 19686: Add objects.search a 'to_model' param This patch introduces a new parameter to the objects.search Mojo helper. The idea behind this, is that if there's any attribute name mapping between the DB objects and the API exposed ones, we should be able to pass it to objects.search so the filtering query params are mapped correctly for building the DBIC query, like this example: my $patrons_set = Koha::Patrons->new; my @patrons = $c->objects->search( $patrons_set, \_model )->as_list; # and probably @patrons = map {to_api($_)} @patrons; The to_model function needs to avoid autovivification, to prevent messing with the query parameters (undef params). To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! Params get mapped! - Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Bourgault -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 David Bourgaultchanged: What|Removed |Added Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 David Bourgaultchanged: What|Removed |Added Attachment #69315|0 |1 is obsolete|| --- Comment #6 from David Bourgault --- Created attachment 69463 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69463=edit Bug 19686: Unit tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Bourgault -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 --- Comment #5 from David Bourgault--- So this fails for me. I get failed test messages that look like this: # Failed test 'exact match for JSON Pointer "/0/firstname"' # at t/db_dependent/Koha/REST/Plugin/Objects.t line 168. # got: 'Emmanuel' # expected: 'Manuel' But I also get this error at the beginning of the prove command: t/db_dependent/Koha/REST/Plugin/Objects.t .. DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_master_dev_inlibro`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) [for Statement "DELETE FROM `borrowers`"] at /usr/local/share/perl/5.22.1/DBIx/Class/Storage/DBI.pm line 1836. No method delete found for Koha::Patrons DBIx::Class::Storage::DBI::_dbh_execute(): Cannot delete or update a parent row: a foreign key constraint fails (`koha_master_dev_inlibro`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at /inlibro/git/koha-master-dev-inlibro/Koha/Objects.pm line 388 at t/db_dependent/Koha/REST/Plugin/Objects.t line 76. Is this a patch error or could it be a DB error? -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Status|Patch doesn't apply |Needs Signoff --- Comment #4 from Tomás Cohen Arazi --- David, please apply the dependencies in this specific order: - 19234 - 19369 - 19287 - 19370 - 19410 I've just tested it and it applies correctly. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 David Bourgaultchanged: What|Removed |Added CC||david.bourga...@inlibro.com Status|Needs Signoff |Patch doesn't apply --- Comment #3 from David Bourgault --- fatal: sha1 information is lacking or useless (t/db_dependent/Koha/REST/Plugin/Objects.t). -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Blocks||19250 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19250 [Bug 19250] Add pagination to /acquisitions/vendors -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added CC||tomasco...@gmail.com Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 --- Comment #2 from Tomás Cohen Arazi--- Created attachment 69316 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69316=edit Bug 19686: Add objects.search a 'to_model' param This patch introduces a new parameter to the objects.search Mojo helper. The idea behind this, is that if there's any attribute name mapping between the DB objects and the API exposed ones, we should be able to pass it to objects.search so the filtering query params are mapped correctly for building the DBIC query, like this example: my $patrons_set = Koha::Patrons->new; my @patrons = $c->objects->search( $patrons_set, \_model )->as_list; # and probably @patrons = map {to_api($_)} @patrons; The to_model function needs to avoid autovivification, to prevent messing with the query parameters (undef params). To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: Tests pass! Params get mapped! - Sign off :-D Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 --- Comment #1 from Tomás Cohen Arazi--- Created attachment 69315 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69315=edit Bug 19686: Unit tests Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added CC||julian.maur...@biblibre.com ||, lari.task...@jns.fi, ||matthias.meusburger@biblibr ||e.com -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 19686] objects.search helper needs a to_model param
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19686 Tomás Cohen Arazichanged: What|Removed |Added Depends on||19410 Assignee|koha-b...@lists.koha-commun |tomasco...@gmail.com |ity.org | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19410 [Bug 19410] Add a helper function for generating object searches for the API -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. ___ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/