handling multi types and acc-period/repositories endpoint

This commit is contained in:
2021-05-13 00:54:32 +02:00
parent 4a04628d5b
commit 87e2ac9386
9 changed files with 434 additions and 6 deletions

View File

@@ -1,5 +1,29 @@
components:
schemas:
Date:
type: object
properties:
datetime:
type: string
format: date-time
Person:
type: object
properties:
id:
type: integer
firstName:
type: string
lastName:
type: string
text:
type: string
description: a canonical representation for the person name
birthdate:
$ref: '#/components/schemas/Date'
phonenumber:
type: string
mobilenumber:
type: string
PersonById:
type: object
properties:
@@ -12,6 +36,12 @@ components:
required:
- id
- type
# should go to third party
ThirdParty:
type: object
properties:
text:
type: string
ThirdPartyById:
type: object
properties:
@@ -35,7 +65,33 @@ components:
type: integer
requestorAnonymous:
type: boolean
Resource:
type: object
properties:
type:
type: string
enum:
- 'accompanying_period_resource'
readOnly: true
id:
type: integer
readOnly: true
resource:
anyOf:
- $ref: '#/components/schemas/PersonById'
- $ref: '#/components/schemas/ThirdPartyById'
ResourceById:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- 'accompanying_period_resource'
required:
- id
- type
paths:
/1.0/person/accompanying-course/{id}.json:
@@ -213,3 +269,79 @@ paths:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/resource.json:
post:
tags:
- person
summary: "Add a resource to the accompanying course"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "A resource"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Resource'
examples:
add person with id 50:
summary: "a person with id 50"
value:
type: accompanying_period_resource
resource:
type: person
id: 50
add thirdparty with id 100:
summary: "a third party with id 100"
value:
type: accompanying_period_resource
resource:
type: thirdparty
id: 100
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
delete:
tags:
- person
summary: "Remove the resource"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "A resource"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceById'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"