Bug 38226 - Add RPC endpoint for batch filling empty callnumbers
Summary: Add RPC endpoint for batch filling empty callnumbers
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 34784 38224
  Show dependency treegraph
 
Reported: 2024-10-22 12:40 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2024-11-07 14:43 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38226: API spec (6.04 KB, patch)
2024-10-22 12:41 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38226: Add RPC route for updating item callnumbers for a biblio (10.16 KB, patch)
2024-10-22 12:42 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 38226: API spec (6.10 KB, patch)
2024-11-07 14:43 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38226: Add RPC route for updating item callnumbers for a biblio (10.21 KB, patch)
2024-11-07 14:43 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2024-10-22 12:40:03 UTC
Originally proposed on bug 34784, I'm moving the patches here to ease readability and have a smaller testing scope.
Comment 1 Tomás Cohen Arazi (tcohen) 2024-10-22 12:41:57 UTC
Created attachment 173132 [details] [review]
Bug 38226: API spec

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2024-10-22 12:42:00 UTC
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>
Comment 3 Nick Clemens (kidclamp) 2024-11-07 14:43:05 UTC
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>
Comment 4 Nick Clemens (kidclamp) 2024-11-07 14:43:07 UTC
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>