From 5234bc22f4c0d929914c9c0a5bfba90d1134c049 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 19 Oct 2022 11:31:05 +0000 Subject: [PATCH] Bug 32030: Add document to license - REST API spec Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- api/v1/swagger/definitions/erm_agreement.yaml | 2 +- ...rm_agreement_document.yaml => erm_document.yaml} | 9 ++++++++- api/v1/swagger/definitions/erm_license.yaml | 5 +++++ api/v1/swagger/paths/erm_documents.yaml | 13 ++++--------- api/v1/swagger/paths/erm_licenses.yaml | 2 ++ api/v1/swagger/swagger.yaml | 4 ++-- 6 files changed, 22 insertions(+), 13 deletions(-) rename api/v1/swagger/definitions/{erm_agreement_document.yaml => erm_document.yaml} (87%) diff --git a/api/v1/swagger/definitions/erm_agreement.yaml b/api/v1/swagger/definitions/erm_agreement.yaml index 88f80f180e..f2c3f4917b 100644 --- a/api/v1/swagger/definitions/erm_agreement.yaml +++ b/api/v1/swagger/definitions/erm_agreement.yaml @@ -63,7 +63,7 @@ properties: type: array description: documents items: - $ref: erm_agreement_document.yaml + $ref: erm_document.yaml vendor: description: Information about the vendor type: diff --git a/api/v1/swagger/definitions/erm_agreement_document.yaml b/api/v1/swagger/definitions/erm_document.yaml similarity index 87% rename from api/v1/swagger/definitions/erm_agreement_document.yaml rename to api/v1/swagger/definitions/erm_document.yaml index fddef432be..34ac2bd437 100644 --- a/api/v1/swagger/definitions/erm_agreement_document.yaml +++ b/api/v1/swagger/definitions/erm_document.yaml @@ -5,8 +5,15 @@ properties: type: integer description: internally assigned identifier agreement_id: - type: integer + type: + - integer + - "null" description: Internal agreement identifier + license_id: + type: + - integer + - "null" + description: Internal license identifier file_name: type: - string diff --git a/api/v1/swagger/definitions/erm_license.yaml b/api/v1/swagger/definitions/erm_license.yaml index f9b52dcab1..87c2da766f 100644 --- a/api/v1/swagger/definitions/erm_license.yaml +++ b/api/v1/swagger/definitions/erm_license.yaml @@ -38,6 +38,11 @@ properties: - "null" format: date description: End of the license + documents: + type: array + description: documents + items: + $ref: erm_document.yaml vendor: description: Information about the vendor type: diff --git a/api/v1/swagger/paths/erm_documents.yaml b/api/v1/swagger/paths/erm_documents.yaml index 0dc73a3052..31ea135413 100644 --- a/api/v1/swagger/paths/erm_documents.yaml +++ b/api/v1/swagger/paths/erm_documents.yaml @@ -1,20 +1,15 @@ --- -"/erm/agreements/{agreement_id}/documents/{document_id}/file/content": +"/erm/documents/{document_id}/file/content": get: x-mojo-to: ERM::Documents#get - operationId: downloadErmAgreementDocument + operationId: downloadErmDocument tags: - document - summary: Download agreement document + summary: Download erm document produces: - application/octet-stream parameters: - - description: Case insensitive search on agreement agreement_id - in: path - name: agreement_id - required: true - type: integer - - description: Case insensitive search on agreement document_id + - description: Case insensitive search on document_id in: path name: document_id required: true diff --git a/api/v1/swagger/paths/erm_licenses.yaml b/api/v1/swagger/paths/erm_licenses.yaml index ad2dd8ce8a..520cb30ca6 100644 --- a/api/v1/swagger/paths/erm_licenses.yaml +++ b/api/v1/swagger/paths/erm_licenses.yaml @@ -179,6 +179,7 @@ erm: 1 x-koha-embed: - agreements + - documents put: x-mojo-to: ERM::Licenses#update operationId: updateERMlicenses @@ -235,6 +236,7 @@ erm: 1 x-koha-embed: - agreements + - documents delete: x-mojo-to: ERM::Licenses#delete operationId: deleteERMlicenses diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index f77984fb0f..f3f1af4bc4 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -171,8 +171,8 @@ paths: $ref: ./paths/erm_agreements.yaml#/~1erm~1agreements "/erm/agreements/{agreement_id}": $ref: "./paths/erm_agreements.yaml#/~1erm~1agreements~1{agreement_id}" - "/erm/agreements/{agreement_id}/documents/{document_id}/file/content": - $ref: "./paths/erm_documents.yaml#/~1erm~1agreements~1{agreement_id}~1documents~1{document_id}~1file~1content" + "/erm/documents/{document_id}/file/content": + $ref: "./paths/erm_documents.yaml#/~1erm~1documents~1{document_id}~1file~1content" "/erm/eholdings/{provider}/titles": $ref: "./paths/erm_eholdings_titles.yaml#/~1erm~1eholdings~1{provider}~1titles" /erm/eholdings/local/titles/import: -- 2.39.2