Archived
2

adapted existing /sample methods to condition, removed /condition route

This commit is contained in:
VLE2FE
2020-05-27 14:31:17 +02:00
parent 2829752d0c
commit 0acb9dd6fc
34 changed files with 1753 additions and 1374 deletions

View File

@ -66,7 +66,6 @@ paths:
- $ref: 'others.yaml'
- $ref: 'sample.yaml'
- $ref: 'material.yaml'
- $ref: 'condition.yaml'
- $ref: 'measurement.yaml'
- $ref: 'template.yaml'
- $ref: 'model.yaml'

View File

@ -1,111 +0,0 @@
/condition/{id}:
parameters:
- $ref: 'api.yaml#/components/parameters/Id'
get:
summary: condition by id
description: 'Auth: all, levels: read, write, maintain, dev, admin'
x-doc: status handling (accessible (only for maintain/admin))? # TODO after decision
tags:
- /condition
responses:
200:
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/Condition'
400:
$ref: 'api.yaml#/components/responses/400'
401:
$ref: 'api.yaml#/components/responses/401'
404:
$ref: 'api.yaml#/components/responses/404'
500:
$ref: 'api.yaml#/components/responses/500'
put:
summary: change condition
description: 'Auth: basic, levels: write, maintain, dev, admin <br>Only maintain and admin are allowed to reference samples created by another user'
x-doc: status is reset to 0 on any changes
tags:
- /condition
security:
- BasicAuth: []
requestBody:
required: true
content:
application/json:
schema:
allOf:
- $ref: 'api.yaml#/components/schemas/_Id'
properties:
parameters:
type: object
responses:
200:
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/Condition'
400:
$ref: 'api.yaml#/components/responses/400'
401:
$ref: 'api.yaml#/components/responses/401'
403:
$ref: 'api.yaml#/components/responses/403'
404:
$ref: 'api.yaml#/components/responses/404'
500:
$ref: 'api.yaml#/components/responses/500'
delete:
summary: delete condition
description: 'Auth: basic, levels: write, maintain, dev, admin'
x-doc: sets status to -1
tags:
- /condition
security:
- BasicAuth: []
responses:
200:
$ref: 'api.yaml#/components/responses/Ok'
400:
$ref: 'api.yaml#/components/responses/400'
401:
$ref: 'api.yaml#/components/responses/401'
403:
$ref: 'api.yaml#/components/responses/403'
404:
$ref: 'api.yaml#/components/responses/404'
500:
$ref: 'api.yaml#/components/responses/500'
/condition/new:
post:
summary: add condition
description: 'Auth: basic, levels: write, maintain, dev, admin <br>Only maintain and admin are allowed to reference samples created by another user'
x-doc: 'Adds status: 0 automatically'
tags:
- /condition
security:
- BasicAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/Condition'
responses:
200:
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/Condition'
400:
$ref: 'api.yaml#/components/responses/400'
401:
$ref: 'api.yaml#/components/responses/401'
403:
$ref: 'api.yaml#/components/responses/403'
500:
$ref: 'api.yaml#/components/responses/500'

View File

@ -19,7 +19,7 @@
500:
$ref: 'api.yaml#/components/responses/500'
/samples{group}:
/samples/{group}:
parameters:
- $ref: 'api.yaml#/components/parameters/Group'
get:
@ -48,7 +48,7 @@
get:
summary: TODO sample details
description: 'Auth: all, levels: read, write, maintain, dev, admin'
x-doc: status handling (accessible (only for maintain/admin))? # TODO after decision
x-doc: deleted samples are available only for maintain/admin
tags:
- /sample
responses:

View File

@ -24,6 +24,15 @@ SampleProperties:
batch:
type: string
example: 1560237365
condition:
type: object
properties:
condition_template:
$ref: 'api.yaml#/components/schemas/Id'
example:
condition_template: 5ea0450ed851c30a90e70894
material: hot air
weeks: 5
SampleRefs:
allOf:
@ -55,7 +64,7 @@ Sample:
type: array
items:
properties:
id:
sample_id:
$ref: 'api.yaml#/components/schemas/Id'
relation:
type: string
@ -67,7 +76,8 @@ SampleDetail:
- $ref: 'api.yaml#/components/schemas/SampleProperties'
properties:
material:
$ref: 'api.yaml#/components/schemas/Material'
allOf:
- $ref: 'api.yaml#/components/schemas/Material'
notes:
type: object
properties:
@ -77,10 +87,14 @@ SampleDetail:
type: array
items:
$ref: 'api.yaml#/components/schemas/Id'
conditions:
measurements:
type: array
items:
$ref: 'api.yaml#/components/schemas/Condition'
allOf:
- $ref: 'api.yaml#/components/schemas/Measurement'
user:
type: string
example: admin
Material:
allOf:
@ -115,21 +129,6 @@ Material:
type: string
example: 5514263423
Condition:
allOf:
- $ref: 'api.yaml#/components/schemas/_Id'
properties:
sample_id:
$ref: 'api.yaml#/components/schemas/Id'
number:
type: string
readOnly: true
example: B1
parameters:
type: object
treatment_template:
$ref: 'api.yaml#/components/schemas/Id'
Measurement:
allOf:
- $ref: 'api.yaml#/components/schemas/_Id'
@ -166,7 +165,7 @@ Template:
min: 0
max: 2
TreatmentTemplate:
ConditionTemplate:
allOf:
- $ref: 'api.yaml#/components/schemas/Template'
properties:

View File

@ -1,6 +1,6 @@
/template/treatments:
/template/conditions:
get:
summary: all available treatment methods
summary: all available condition methods
description: 'Auth: basic, levels: read, write, maintain, dev, admin'
tags:
- /template
@ -8,23 +8,23 @@
- BasicAuth: []
responses:
200:
description: list of treatments
description: list of conditions
content:
application/json:
schema:
type: array
items:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
401:
$ref: 'api.yaml#/components/responses/401'
500:
$ref: 'api.yaml#/components/responses/500'
/template/treatment/{id}:
/template/condition/{id}:
parameters:
- $ref: 'api.yaml#/components/parameters/Id'
get:
summary: treatment method details
summary: condition method details
description: 'Auth: basic, levels: read, write, maintain, admin'
tags:
- /template
@ -32,11 +32,11 @@
- BasicAuth: []
responses:
200:
description: treatment details
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
401:
$ref: 'api.yaml#/components/responses/401'
404:
@ -44,7 +44,7 @@
500:
$ref: 'api.yaml#/components/responses/500'
put:
summary: change treatment method
summary: change condition method
description: 'Auth: basic, levels: maintain, admin'
x-doc: With a change a new version is set, resulting in a new template with a new id
tags:
@ -56,14 +56,14 @@
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
responses:
200:
description: treatment details
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
400:
$ref: 'api.yaml#/components/responses/400'
401:
@ -75,9 +75,9 @@
500:
$ref: 'api.yaml#/components/responses/500'
/template/treatment/new:
/template/condition/new:
post:
summary: add treatment method
summary: add condition method
description: 'Auth: basic, levels: maintain, admin'
tags:
- /template
@ -88,14 +88,14 @@
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
responses:
200:
description: treatment details
description: condition details
content:
application/json:
schema:
$ref: 'api.yaml#/components/schemas/TreatmentTemplate'
$ref: 'api.yaml#/components/schemas/ConditionTemplate'
400:
$ref: 'api.yaml#/components/responses/400'
401: