Summary: | Add RPC endpoint for batch filling empty callnumbers | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | REST API | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | Needs Signoff --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | jan.kissig, jonathan.druart, katrin.fischer, kyle, martin.renvoize, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 34784, 38224 | ||
Attachments: |
Bug 38226: API spec
Bug 38226: Add RPC route for updating item callnumbers for a biblio Bug 38226: API spec Bug 38226: Add RPC route for updating item callnumbers for a biblio |
Description
Tomás Cohen Arazi (tcohen)
2024-10-22 12:40:03 UTC
Created attachment 173132 [details] [review] Bug 38226: API spec Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 173133 [details] [review] Bug 38226: Add RPC route for updating item callnumbers for a biblio This patch takes the idea implemented on the original patch, moves it to the /rpc namespace to make it clear this is not a RESTful endpoint. Code gets improved a bit, using some patterns we are using nowadays. The return value gets a bit more information and. A big change is it now uses `Koha::Items->batch_update`. It originally used `Koha::Items->update` with the `no_trigger` option. It felt like `batch_update` is a bit more smart in terms of triggering indexing at the end of the update, and only for the host biblio. It looks like that was the spirit of the original implementation, but missed to actually trigger indexing at the end of the call. To test: 1. Apply this patches 2.Run: $ ktd --shell k$ yarn api:bundle k$ restart_all 3. Run the tests: k$ prove t/db_dependent/api/v1/rpc/biblios.t => SUCCESS: Tests pass! 4. Try the new routes with Postman or your favourite tool (if they don't match) => SUCCESS: The desired behavior is what you get. 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Created attachment 174242 [details] [review] Bug 38226: API spec Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Created attachment 174243 [details] [review] Bug 38226: Add RPC route for updating item callnumbers for a biblio This patch takes the idea implemented on the original patch, moves it to the /rpc namespace to make it clear this is not a RESTful endpoint. Code gets improved a bit, using some patterns we are using nowadays. The return value gets a bit more information and. A big change is it now uses `Koha::Items->batch_update`. It originally used `Koha::Items->update` with the `no_trigger` option. It felt like `batch_update` is a bit more smart in terms of triggering indexing at the end of the update, and only for the host biblio. It looks like that was the spirit of the original implementation, but missed to actually trigger indexing at the end of the call. To test: 1. Apply this patches 2.Run: $ ktd --shell k$ yarn api:bundle k$ restart_all 3. Run the tests: k$ prove t/db_dependent/api/v1/rpc/biblios.t => SUCCESS: Tests pass! 4. Try the new routes with Postman or your favourite tool (if they don't match) => SUCCESS: The desired behavior is what you get. 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> This /rpc namespace needs to be documented. We should make sure it does not become a mess quickly because it would be easier to write such route than think of a good REST API pattern. curl -u koha:koha http://localhost:8081/rpc/biblios/1/items/1/populate_empty_callnumbers It gets a 404, what am I missing? |