Bug 32030: Add document to license - REST API spec
authorPedro Amorim <pjamorim91@gmail.com>
Wed, 19 Oct 2022 11:31:05 +0000 (11:31 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 8 Nov 2022 12:44:31 +0000 (09:44 -0300)
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
api/v1/swagger/definitions/erm_agreement.yaml
api/v1/swagger/definitions/erm_agreement_document.yaml [deleted file]
api/v1/swagger/definitions/erm_document.yaml [new file with mode: 0644]
api/v1/swagger/definitions/erm_license.yaml
api/v1/swagger/paths/erm_documents.yaml
api/v1/swagger/paths/erm_licenses.yaml
api/v1/swagger/swagger.yaml

index 88f80f1..f2c3f49 100644 (file)
@@ -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_agreement_document.yaml
deleted file mode 100644 (file)
index fddef43..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
----
-type: object
-properties:
-  document_id:
-    type: integer
-    description: internally assigned identifier
-  agreement_id:
-    type: integer
-    description: Internal agreement identifier
-  file_name:
-    type:
-      - string
-      - "null"
-    description: Name of the file
-  file_type:
-    type:
-      - string
-      - "null"
-    readOnly: true
-    description: Type of the file
-  file_description:
-    type:
-      - string
-      - "null"
-    description: Description of the file
-  file_content:
-    type:
-      - string
-      - "null"
-    description: Content of the file
-  uploaded_on:
-    type:
-      - string
-      - "null"
-    readOnly: true
-    format: date-time
-    description: Datetime of the upload
-  physical_location:
-    type:
-      - string
-      - "null"
-    description: Physical location of the document
-  uri:
-    description: URI of the document
-    type:
-      - string
-      - "null"
-  notes:
-    type:
-      - string
-      - "null"
-additionalProperties: false
diff --git a/api/v1/swagger/definitions/erm_document.yaml b/api/v1/swagger/definitions/erm_document.yaml
new file mode 100644 (file)
index 0000000..34ac2bd
--- /dev/null
@@ -0,0 +1,59 @@
+---
+type: object
+properties:
+  document_id:
+    type: integer
+    description: internally assigned identifier
+  agreement_id:
+    type:
+      - integer
+      - "null"
+    description: Internal agreement identifier
+  license_id:
+    type:
+      - integer
+      - "null"
+    description: Internal license identifier
+  file_name:
+    type:
+      - string
+      - "null"
+    description: Name of the file
+  file_type:
+    type:
+      - string
+      - "null"
+    readOnly: true
+    description: Type of the file
+  file_description:
+    type:
+      - string
+      - "null"
+    description: Description of the file
+  file_content:
+    type:
+      - string
+      - "null"
+    description: Content of the file
+  uploaded_on:
+    type:
+      - string
+      - "null"
+    readOnly: true
+    format: date-time
+    description: Datetime of the upload
+  physical_location:
+    type:
+      - string
+      - "null"
+    description: Physical location of the document
+  uri:
+    description: URI of the document
+    type:
+      - string
+      - "null"
+  notes:
+    type:
+      - string
+      - "null"
+additionalProperties: false
index f9b52dc..87c2da7 100644 (file)
@@ -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:
index 0dc73a3..31ea135 100644 (file)
@@ -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
index ad2dd8c..520cb30 100644 (file)
         erm: 1
     x-koha-embed:
       - agreements
+      - documents
   put:
     x-mojo-to: ERM::Licenses#update
     operationId: updateERMlicenses
         erm: 1
     x-koha-embed:
       - agreements
+      - documents
   delete:
     x-mojo-to: ERM::Licenses#delete
     operationId: deleteERMlicenses
index f77984f..f3f1af4 100644 (file)
@@ -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: