[Bug 29668] New: Add API route to create a basket
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Bug ID: 29668 Summary: Add API route to create a basket Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: REST API Assignee: julian.maurice@biblibre.com Reporter: julian.maurice@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 128371 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=128371&action=edit Bug 29668: Add API route to add a basket Example usage: POST /api/v1/acquisitions/baskets { "vendor_id": 1, "name": "Basket #1", } Test plan: 1. Try requesting this endpoint with your favorite API tool (I recommend https://github.com/frigus02/RESTer) 2. Run `prove t/db_dependent/api/v1/acquisitions_baskets/post.t` -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Julian Maurice <julian.maurice@biblibre.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=29668 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com, 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=29668 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply CC| |paul.derscheid@lmscloud.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #2 from Paul Derscheid <paul.derscheid@lmscloud.de> --- This isn't compatible with the current master branch because of some changes in the api directory structure, but I think you already know. Some merge conflicts have to be resolved. There is the new route acquisitions/baskets/managers which probably wasn't there yet when this patch was written. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Depends on| |38204 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38204 [Bug 38204] Add `GET /acquisitions/baskets` -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Must also be rebased now that Bug 38204 is in -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #128371|0 |1 is obsolete| | --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 183072 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183072&action=edit Bug 29668: Add API route to add a basket Example usage: POST /api/v1/acquisitions/baskets { "vendor_id": 1, "name": "Basket #1", } Test plan: 1. Try requesting this endpoint with your favorite API tool (I recommend https://github.com/frigus02/RESTer) 2. Run `prove t/db_dependent/api/v1/acquisitions_baskets/post.t` Edit (tcohen): Re-did the commit with some fixes in the spec 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=29668 --- Comment #5 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 183073 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183073&action=edit Bug 29668: Move tests 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=29668 --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 183074 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183074&action=edit Bug 29668: Adapt to current guidelines The added patches make some changes: * $c->req->json is used to access the request body, as explained by the Mojolicious OpenAPI plugin author it should be done. * Instead of calling `$basket->to_api` we use the `$c->objects->to_api` helper which deals with calling context (embeds, etc). Otherwise it would require doing it manually if embeds are added. * Tests are grouped together the same way the rest of them are. To test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/acquisitions_baskets.t => SUCCESS: Tests pass! 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=29668 Tomás Cohen Arazi (tcohen) <tomascohen@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=29668 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Signed Off |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #7 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189122 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189122&action=edit Bug 29668: Add API route to add a basket Example usage: POST /api/v1/acquisitions/baskets { "vendor_id": 1, "name": "Basket #1", } Test plan: 1. Try requesting this endpoint with your favorite API tool (I recommend https://github.com/frigus02/RESTer) 2. Run `prove t/db_dependent/api/v1/acquisitions_baskets/post.t` Edit (tcohen): Re-did the commit with some fixes in the spec Signed-off-by: Tomás 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=29668 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189123 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189123&action=edit Bug 29668: Move tests Signed-off-by: Tomás 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=29668 --- Comment #9 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189124 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189124&action=edit Bug 29668: Adapt to current guidelines The added patches make some changes: * $c->req->json is used to access the request body, as explained by the Mojolicious OpenAPI plugin author it should be done. * Instead of calling `$basket->to_api` we use the `$c->objects->to_api` helper which deals with calling context (embeds, etc). Otherwise it would require doing it manually if embeds are added. * Tests are grouped together the same way the rest of them are. To test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/acquisitions_baskets.t => SUCCESS: Tests pass! Signed-off-by: Tomás 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=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183072|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=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183073|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=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183074|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=29668 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Laura.escamilla@bywatersolu | |tions.com Status|Signed Off |Failed QA --- Comment #10 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Tests failed for me :( kohadev-koha@kohadevbox:koha(main)$ prove t/db_dependent/api/v1/acquisitions_baskets.t t/db_dependent/api/v1/acquisitions_baskets.t .. 1/4 # Failed test '403 Forbidden' # at t/db_dependent/api/v1/acquisitions_baskets.t line 124. # got: '404' # expected: '403' # Failed test '400 Bad Request' # at t/db_dependent/api/v1/acquisitions_baskets.t line 134. # got: '404' # expected: '400' # Failed test '201 Created' # at t/db_dependent/api/v1/acquisitions_baskets.t line 136. # got: '404' # expected: '201' # Failed test 'has value for JSON Pointer "/basket_id"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 136. # Failed test 'exact match for JSON Pointer "/vendor_id"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 136. # got: undef # expected: '5' # Failed test '201 Created' # at t/db_dependent/api/v1/acquisitions_baskets.t line 146. # got: '404' # expected: '201' # Failed test 'has value for JSON Pointer "/basket_id"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 146. # Failed test 'exact match for JSON Pointer "/vendor_id"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 146. # got: undef # expected: '5' # Failed test 'exact match for JSON Pointer "/name"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 146. # got: undef # expected: 'Basket #1' # Failed test 'exact match for JSON Pointer "/vendor_note"' # at t/db_dependent/api/v1/acquisitions_baskets.t line 146. # got: undef # expected: 'Vendor note' # Looks like you failed 10 tests of 14. # Failed test 'add() tests' # at t/db_dependent/api/v1/acquisitions_baskets.t line 149. # Looks like you failed 1 test of 4. t/db_dependent/api/v1/acquisitions_baskets.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/4 subtests Test Summary Report ------------------- t/db_dependent/api/v1/acquisitions_baskets.t (Wstat: 256 (exited 1) Tests: 4 Failed: 1) Failed test: 3 Non-zero exit status: 1 Files=1, Tests=4, 3 wallclock secs ( 0.01 usr 0.00 sys + 2.92 cusr 0.17 csys = 3.10 CPU) Result: FAIL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #11 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- (In reply to Laura Escamilla from comment #10)
Tests failed for me :(
# got: '404' # expected: '403'
Did you run `yarn api:bundle` before the tests? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #12 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- No I didn't.... I will test this again! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189122|0 |1 is obsolete| | --- Comment #13 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Created attachment 189227 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189227&action=edit Bug 29668: Add API route to add a basket Example usage: POST /api/v1/acquisitions/baskets { "vendor_id": 1, "name": "Basket #1", } Test plan: 1. Try requesting this endpoint with your favorite API tool (I recommend https://github.com/frigus02/RESTer) 2. Run `prove t/db_dependent/api/v1/acquisitions_baskets/post.t` Edit (tcohen): Re-did the commit with some fixes in the spec Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189123|0 |1 is obsolete| | --- Comment #14 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Created attachment 189228 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189228&action=edit Bug 29668: Move tests Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189124|0 |1 is obsolete| | --- Comment #15 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Created attachment 189229 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189229&action=edit Bug 29668: Adapt to current guidelines The added patches make some changes: * $c->req->json is used to access the request body, as explained by the Mojolicious OpenAPI plugin author it should be done. * Instead of calling `$basket->to_api` we use the `$c->objects->to_api` helper which deals with calling context (embeds, etc). Otherwise it would require doing it manually if embeds are added. * Tests are grouped together the same way the rest of them are. To test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/acquisitions_baskets.t => SUCCESS: Tests pass! Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #16 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Thank you, Tomas and Julian! This worked great so I'm passing QA. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |Laura.escamilla@bywatersolu | |tions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_26_05_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #17 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_26_05_candidate |release-notes-needed --- Comment #18 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- please add release notes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.05.00 |26.05.00,25.11.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 --- Comment #19 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29668 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|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=29668 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED --- Comment #20 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- Not backporting to 25.05 as this is an enhancement. Happy to revisit if needed. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org