https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42503

--- Comment #13 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 199160
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199160&action=edit
Bug 42503: Add holds queue REST API endpoint

Adds GET /api/v1/holds/queue backed by Koha::Hold::HoldsQueueItems
(the tmp_holdsqueue table populated by the holds queue cron job).

Changes:
- Koha/REST/V1/Holds/Queue.pm: controller with list method
- Koha/Hold/HoldsQueueItem.pm: Koha::Object class with relationship
  accessors (patron, biblio, item), strings_map, and to_api_mapping
- Koha/Hold/HoldsQueueItems.pm: Koha::Objects class with
  api_query_fixer for biblioitem field resolution
- Koha/Schema/Result/TmpHoldsqueue.pm: adds 'patron' relationship
  alias so patron.* fields are embeddable and sortable
- api/v1/swagger/paths/holds_queue.yaml: path spec
- api/v1/swagger/definitions/holds_queue_item.yaml: definition

Supports filtering by holding_library_id, pickup_library_id,
biblio_id, item_id, patron_id, item_level. Embeds: +strings, biblio,
item, item+strings, patron, patron+strings, patron.notice_email_address.

Sorting on embedded fields (patron.surname, patron.category_id,
biblio.publisher) works correctly.

Test plan:
1. Apply all patches for this bug
2. Run:
   $ ktd --shell
  k$ yarn build ; koha-plack --restart kohadev
  k$ prove t/db_dependent/api/v1/holds_queue.t
=> SUCCESS: Tests pass!
3. Populate the holds queue:
  k$ perl misc/cronjobs/holds/build_holdsqueue.pl
4. Verify the endpoint:
   GET /api/v1/holds/queue
   x-koha-embed: biblio,item+strings,patron+strings
=> SUCCESS: Returns holds queue items with embedded data
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://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/

Reply via email to