Description
Tomás Cohen Arazi (tcohen)
2023-07-20 18:48:17 UTC
Created attachment 153744 [details] [review] Bug 34333: Add Koha::Hold->cancellation_requested This patch adds a helper method for telling if a hold has cancellation requests. To be used for embedding such information. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Hold.t => SUCCESS: Tests pass, the new method is covered by tests. 3. Sign off :-D Created attachment 153745 [details] [review] 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 Created attachment 155735 [details] [review] Bug 34333: Add Koha::Hold->cancellation_requested This patch adds a helper method for telling if a hold has cancellation requests. To be used for embedding such information. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Hold.t => SUCCESS: Tests pass, the new method is covered by tests. 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Created attachment 155736 [details] [review] 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> Testing notes (using KTD and Postman): 1. Enable RESTBasicAuth 2. Place some holds. 3. When `x-koha-embed` header with `cancellation_requested` added, there is an extra line in results for each hold: "cancellation_requested": false, Created attachment 155794 [details] [review] Bug 34333: Add Koha::Hold->cancellation_requested This patch adds a helper method for telling if a hold has cancellation requests. To be used for embedding such information. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Hold.t => SUCCESS: Tests pass, the new method is covered by tests. 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 155795 [details] [review] 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> Clear improvement, no QA issues.. Passing. Pushed to master for 23.11. Nice work everyone, thanks! Small enhancement on API, I choose to backport Pushed to 23.05.x for 23.05.04 Nice work everyone! Pushed to oldstable for 22.11.x Tomas, yesterday's weirdness is coming from: + - 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 collectionFormat is an attribute of the header, no the items, it should have been: + - 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 |