chill-bundles/src/Bundle/ChillPersonBundle/chill.api.specs.yaml

728 lines
18 KiB
YAML

components:
schemas:
# should go to main
Date:
type: object
properties:
datetime:
type: string
format: date-time
Scope:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- scope
name:
type: object
additionalProperties:
type: string
example:
fr: Social
ScopeById:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- scope
required:
- id
- scope
# ok to stay here
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:
id:
type: integer
type:
type: string
enum:
- 'person'
required:
- id
- type
# should go to third party
ThirdParty:
type: object
properties:
text:
type: string
ThirdPartyById:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- 'thirdparty'
required:
- id
- type
# ok to stay here
AccompanyingPeriod:
type: object
properties:
type:
type: string
enum:
- accompanying_period
id:
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
Comment:
type: object
properties:
type:
type: string
enum:
- 'accompanying_period_comment'
readOnly: true
id:
type: integer
readOnly: true
content:
type: string
CommentById:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- 'accompanying_period_comment'
required:
- id
- type
SocialIssue:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- 'social_issue'
parent_id:
type: integer
readOnly: true
children_ids:
type: array
items:
type: integer
readOnly: true
title:
type: object
additionalProperties:
type: string
example:
fr: Accompagnement Social Adulte
readOnly: true
text:
type: string
readOnly: true
paths:
/1.0/person/person/{id}.json:
get:
tags:
- person
summary: Get a single person
parameters:
- name: id
in: path
required: true
description: The person's id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "OK"
content:
application/json:
schema:
$ref: "#/components/schemas/Person"
403:
description: "Unauthorized"
/1.0/person/social-work/social-issue.json:
get:
tags:
- social-issue
summary: Return a list of social work
responses:
200:
description: "ok"
/1.0/person/social-work/social-issue/{id}.json:
get:
tags:
- social-issue
summary: Return a social issue by id
parameters:
- name: id
in: path
required: true
description: The social issue's id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/SocialIssue'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/person/accompanying-course/{id}.json:
get:
tags:
- person
summary: "Return the description for an accompanying course (accompanying period)"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
patch:
tags:
- person
summary: "Alter an accompanying course (accompanying period)"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "An accompanying period"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccompanyingPeriod'
examples:
Set the requestor as anonymous:
value:
type: accompanying_period
id: 12345
requestorAnonymous: true
Adding an initial comment:
value:
type: accompanying_period
id: 2668,
initialComment:
type: accompanying_period_comment
content: >
This is my an initial comment.
Say hello to the new "parcours"!
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/requestor.json:
post:
tags:
- person
summary: "Add a requestor 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 person or thirdparty"
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/PersonById'
- $ref: '#/components/schemas/ThirdPartyById'
examples:
add person with id 50:
summary: "a person with id 50"
value:
type: person
id: 50
add thirdparty with id 100:
summary: "a third party with id 100"
value:
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 requestor for the accompanying course"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/participation.json:
post:
tags:
- person
summary: "Add a participant 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 person"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PersonById'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
delete:
tags:
- person
summary: "Remove the participant for 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 person"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PersonById'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
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"
/1.0/person/accompanying-course/{id}/comment.json:
post:
tags:
- person
summary: "Add a comment 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 comment"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
examples:
a single comment:
summary: "a simple comment"
value:
type: accompanying_period_comment
content: |
This is a funny comment I would like to share with you.
Thank you for reading this !
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
delete:
tags:
- person
summary: "Remove the comment"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "A comment"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CommentById'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/scope.json:
post:
tags:
- person
summary: "Add a scope 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 comment"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Scope'
examples:
add a scope:
value:
type: scope
id: 5
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
delete:
tags:
- person
summary: "Remove the scope"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "A scope with his id"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScopeById'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/socialissue.json:
post:
tags:
- person
summary: "Add a social issue 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 social issue by id"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SocialIssue'
examples:
add a social issue:
value:
type: social_issue
id: 5
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
delete:
tags:
- person
summary: "Remove the social issue"
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
requestBody:
description: "A social issue with his id"
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SocialIssue'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/person/accompanying-course/{id}/confirm.json:
post:
tags:
- person
summary: confirm an accompanying course
parameters:
- name: id
in: path
required: true
description: The accompanying period's id
schema:
type: integer
format: integer
minimum: 1
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
400:
description: "transition cannot be applyed"