From eb21536fc65f9514cc460881dbe9f5e78a4c0bb4 Mon Sep 17 00:00:00 2001
From: JeanClement <jeanclement.gallardo@inrae.fr>
Date: Wed, 28 Jun 2023 10:19:16 +0200
Subject: [PATCH 1/4] add steps methods

---
 metexplore3-api.yml             |  3 +++
 paths/steps/get.yml             | 21 +++++++++++++++++++++
 schemas/steps/Step.yml          | 29 +++++++++++++++++++++++++++++
 schemas/steps/StepResponse.yml  |  9 +++++++++
 schemas/steps/Steps.yml         | 17 +++++++++++++++++
 schemas/steps/StepsResponse.yml |  9 +++++++++
 6 files changed, 88 insertions(+)
 create mode 100644 paths/steps/get.yml
 create mode 100644 schemas/steps/Step.yml
 create mode 100644 schemas/steps/StepResponse.yml
 create mode 100644 schemas/steps/Steps.yml
 create mode 100644 schemas/steps/StepsResponse.yml

diff --git a/metexplore3-api.yml b/metexplore3-api.yml
index e0f9e09..afc9c62 100644
--- a/metexplore3-api.yml
+++ b/metexplore3-api.yml
@@ -57,6 +57,9 @@ paths:
   /filter:
     $ref: "paths/filters/get.yml"
 
+  /steps:
+    $ref: "paths/steps/get.yml"
+
 components:
   securitySchemes:
     jwtAuth: 
diff --git a/paths/steps/get.yml b/paths/steps/get.yml
new file mode 100644
index 0000000..35bdb0b
--- /dev/null
+++ b/paths/steps/get.yml
@@ -0,0 +1,21 @@
+get:
+  tags:
+    - Steps
+  summary: Get specific step of an analysis
+  operationId: getSteps
+  x-eov-operation-handler: steps
+  description: Get a specific step of an analysis
+  parameters:
+    - name: id
+      in: query
+      description: the id for the step
+      required: true
+      schema: 
+        type: integer
+  responses:
+    200:
+      description: success
+      content: 
+        application/json:
+          schema:
+            $ref: "../../schemas/steps/StepResponse.yml"
\ No newline at end of file
diff --git a/schemas/steps/Step.yml b/schemas/steps/Step.yml
new file mode 100644
index 0000000..aaf0d6a
--- /dev/null
+++ b/schemas/steps/Step.yml
@@ -0,0 +1,29 @@
+type: object
+description: "A step from an analysis"
+properties:
+  id:
+    description: "step id"
+    type: integer
+    format: int64
+    example: 22
+  id_analysis:
+    description: "analysis id"
+    type: integer
+    format: int64
+    example: 14
+  name:
+    description: "name of the step"
+    type: string
+    example: "Input"
+  root:
+    description: "Boolean that determined if its the first step of analysis or not"
+    type: boolean
+    example: false
+  type:
+    description: "Determine what types (data, job, ...) is this step"
+    type: string
+    example: "data"
+  description:
+    description: "Description of the step"
+    type: string
+    example: "Input value for next job"
\ No newline at end of file
diff --git a/schemas/steps/StepResponse.yml b/schemas/steps/StepResponse.yml
new file mode 100644
index 0000000..25c0d81
--- /dev/null
+++ b/schemas/steps/StepResponse.yml
@@ -0,0 +1,9 @@
+allOf:
+  - $ref: "../utils/BaseResponse.yml"
+  - type: object
+  - properties:
+      steps:
+        description: "Specific step of an analysis"
+        type: object
+        items: 
+          $ref: "Step.yml"
diff --git a/schemas/steps/Steps.yml b/schemas/steps/Steps.yml
new file mode 100644
index 0000000..822f307
--- /dev/null
+++ b/schemas/steps/Steps.yml
@@ -0,0 +1,17 @@
+type: object
+description: "Array of steps"
+properties:
+  id_analysis:
+    description: "analysis id"
+    type: integer
+    format: int64
+    example: 14
+  name:
+    description: "name of the analysis"
+    type: string
+    example: "Input"
+  steps:
+    description: "Array of step"
+    type: array
+    example: [{id: 134, id_analysis: 123, name: "Input", root: true, type: "data", description: "Input value for mapping"},
+              {id: 135, id_analysis: 123, name: "Mapping", root: false, type: "job", description: "Mapping on metabolites"}]
\ No newline at end of file
diff --git a/schemas/steps/StepsResponse.yml b/schemas/steps/StepsResponse.yml
new file mode 100644
index 0000000..97911c8
--- /dev/null
+++ b/schemas/steps/StepsResponse.yml
@@ -0,0 +1,9 @@
+allOf:
+  - $ref: "../utils/BaseResponse.yml"
+  - type: object
+  - properties:
+      steps:
+        description: "All steps of an analysis"
+        type: array
+        items: 
+          $ref: "Steps.yml"
-- 
GitLab


From acd155adf34d2260f28fe92e1ebe4aa2676d5e6e Mon Sep 17 00:00:00 2001
From: JeanClement <jeanclement.gallardo@inrae.fr>
Date: Wed, 28 Jun 2023 14:54:43 +0200
Subject: [PATCH 2/4] modif architecture + add post method for step

---
 metexplore3-api.yml             |  2 +-
 paths/steps/get.yml             | 47 ++++++++++++++++++---------------
 schemas/steps/Steps.yml         | 17 ------------
 schemas/steps/StepsResponse.yml |  9 -------
 4 files changed, 27 insertions(+), 48 deletions(-)
 delete mode 100644 schemas/steps/Steps.yml
 delete mode 100644 schemas/steps/StepsResponse.yml

diff --git a/metexplore3-api.yml b/metexplore3-api.yml
index afc9c62..0b6c202 100644
--- a/metexplore3-api.yml
+++ b/metexplore3-api.yml
@@ -58,7 +58,7 @@ paths:
     $ref: "paths/filters/get.yml"
 
   /steps:
-    $ref: "paths/steps/get.yml"
+    $ref: "paths/steps/steps.yml"
 
 components:
   securitySchemes:
diff --git a/paths/steps/get.yml b/paths/steps/get.yml
index 35bdb0b..7ea910d 100644
--- a/paths/steps/get.yml
+++ b/paths/steps/get.yml
@@ -1,21 +1,26 @@
-get:
-  tags:
-    - Steps
-  summary: Get specific step of an analysis
-  operationId: getSteps
-  x-eov-operation-handler: steps
-  description: Get a specific step of an analysis
-  parameters:
-    - name: id
-      in: query
-      description: the id for the step
-      required: true
-      schema: 
-        type: integer
-  responses:
-    200:
-      description: success
-      content: 
-        application/json:
-          schema:
-            $ref: "../../schemas/steps/StepResponse.yml"
\ No newline at end of file
+tags:
+  - Steps
+summary: Get specific step of an analysis
+operationId: getSteps
+x-eov-operation-handler: steps
+description: Get a specific step of an analysis
+parameters:
+  - name: id
+    in: query
+    description: the id for the step
+    required: false
+    schema: 
+      type: integer
+  - name: idAnalysis
+    in: query
+    description: the id for an analysis
+    required: false
+    schema:
+      type: integer
+responses:
+  200:
+    description: success
+    content: 
+      application/json:
+        schema:
+          $ref: "../../schemas/steps/StepResponse.yml"
\ No newline at end of file
diff --git a/schemas/steps/Steps.yml b/schemas/steps/Steps.yml
deleted file mode 100644
index 822f307..0000000
--- a/schemas/steps/Steps.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-type: object
-description: "Array of steps"
-properties:
-  id_analysis:
-    description: "analysis id"
-    type: integer
-    format: int64
-    example: 14
-  name:
-    description: "name of the analysis"
-    type: string
-    example: "Input"
-  steps:
-    description: "Array of step"
-    type: array
-    example: [{id: 134, id_analysis: 123, name: "Input", root: true, type: "data", description: "Input value for mapping"},
-              {id: 135, id_analysis: 123, name: "Mapping", root: false, type: "job", description: "Mapping on metabolites"}]
\ No newline at end of file
diff --git a/schemas/steps/StepsResponse.yml b/schemas/steps/StepsResponse.yml
deleted file mode 100644
index 97911c8..0000000
--- a/schemas/steps/StepsResponse.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-allOf:
-  - $ref: "../utils/BaseResponse.yml"
-  - type: object
-  - properties:
-      steps:
-        description: "All steps of an analysis"
-        type: array
-        items: 
-          $ref: "Steps.yml"
-- 
GitLab


From 63ef33cac8cd7013da953dc79b3840fa0033bf6e Mon Sep 17 00:00:00 2001
From: JeanClement <jeanclement.gallardo@inrae.fr>
Date: Wed, 28 Jun 2023 14:55:22 +0200
Subject: [PATCH 3/4] add post method for step 2

---
 paths/steps/add.yml   | 20 ++++++++++++++++++++
 paths/steps/steps.yml |  5 +++++
 2 files changed, 25 insertions(+)
 create mode 100644 paths/steps/add.yml
 create mode 100644 paths/steps/steps.yml

diff --git a/paths/steps/add.yml b/paths/steps/add.yml
new file mode 100644
index 0000000..6f94634
--- /dev/null
+++ b/paths/steps/add.yml
@@ -0,0 +1,20 @@
+tags:
+  - Steps
+summary: add step
+description: add for Step
+operationId: addSteps
+x-eov-operation-handler: steps
+requestBody:
+  content:
+    application/json:
+      schema:
+        type: object
+        items:
+          $ref: ../../schemas/steps/StepResponse.yml
+responses:
+  200:
+    description: success
+    content:
+      application/json:
+        schema:
+          $ref: ../../schemas/steps/StepResponse.yml
\ No newline at end of file
diff --git a/paths/steps/steps.yml b/paths/steps/steps.yml
new file mode 100644
index 0000000..0eb3a12
--- /dev/null
+++ b/paths/steps/steps.yml
@@ -0,0 +1,5 @@
+get:
+  $ref: get.yml
+
+post:
+  $ref: add.yml
\ No newline at end of file
-- 
GitLab


From 3d319e1993596f468ba542cc15d9a8da6f133f84 Mon Sep 17 00:00:00 2001
From: JeanClement <jeanclement.gallardo@inrae.fr>
Date: Thu, 29 Jun 2023 11:46:44 +0200
Subject: [PATCH 4/4] add enum for step type and update add method description

---
 paths/steps/add.yml    | 2 +-
 schemas/steps/Step.yml | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/paths/steps/add.yml b/paths/steps/add.yml
index 6f94634..0237d42 100644
--- a/paths/steps/add.yml
+++ b/paths/steps/add.yml
@@ -1,7 +1,7 @@
 tags:
   - Steps
 summary: add step
-description: add for Step
+description: add a step for a specific analysis
 operationId: addSteps
 x-eov-operation-handler: steps
 requestBody:
diff --git a/schemas/steps/Step.yml b/schemas/steps/Step.yml
index aaf0d6a..6b24526 100644
--- a/schemas/steps/Step.yml
+++ b/schemas/steps/Step.yml
@@ -22,6 +22,7 @@ properties:
   type:
     description: "Determine what types (data, job, ...) is this step"
     type: string
+    enum: [data, job]
     example: "data"
   description:
     description: "Description of the step"
-- 
GitLab