Bug 34333: Add embed option for cancellation_requested for holds

This patch adds the `cancellation_requested` attribute to the hold
object definition, and allows embeding it as on the different holds
endpoints that migt be useful.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t \
           t/db_dependent/api/v1/*holds.t
=> SUCCESS: Tests pass!
3. Play with your REST tool (Postman?) on the following endpoints:
   GET http://localhost:8081/api/v1/holds
   GET http://localhost:8081/api/v1/patrons/:patron_id/holds
on both, pass and not pass the `x-koha-embed` header with
`cancellation_requested` on it.
=> SUCCESS: It is easy! You see the attribute and you don't, and the
content makes sense!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2023-07-20 20:18:27 -03:00
parent 23cfdf97e3
commit 4ce7ce2a15
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
3 changed files with 26 additions and 0 deletions

View file

@ -103,4 +103,10 @@ properties:
item_level:
type: boolean
description: If the hold is placed at item level
cancellation_requested:
type:
- boolean
- "null"
description: Cancellation requests count for the hold (x-koha-embed)
additionalProperties: false

View file

@ -88,6 +88,16 @@
- $ref: "../swagger.yaml#/parameters/q_param"
- $ref: "../swagger.yaml#/parameters/q_body"
- $ref: "../swagger.yaml#/parameters/request_id_header"
- name: x-koha-embed
in: header
required: false
description: Embed list sent as a request header
type: array
items:
type: string
enum:
- cancellation_requested
collectionFormat: csv
produces:
- application/json
responses:

View file

@ -15,6 +15,16 @@
- $ref: "../swagger.yaml#/parameters/q_param"
- $ref: "../swagger.yaml#/parameters/q_body"
- $ref: "../swagger.yaml#/parameters/request_id_header"
- name: x-koha-embed
in: header
required: false
description: Embed list sent as a request header
type: array
items:
type: string
enum:
- cancellation_requested
collectionFormat: csv
produces:
- application/json
responses: