1
0

implements HsOfficePersonController

This commit is contained in:
Michael Hoennig
2022-09-21 09:44:09 +02:00
parent 0bab27d723
commit 00174e4c4a
9 changed files with 895 additions and 17 deletions

View File

@ -16,3 +16,5 @@ map:
null: org.openapitools.jackson.nullable.JsonNullable
/api/hs/office/contacts/{contactUUID}:
null: org.openapitools.jackson.nullable.JsonNullable
/api/hs/office/persons/{personUUID}:
null: org.openapitools.jackson.nullable.JsonNullable

View File

@ -3,16 +3,28 @@ components:
schemas:
HsOfficePersonBase:
HsOfficePersonTypeValues:
- NATURAL # a human
- LEGAL # e.g. Corp., Inc., AG, GmbH, eG
- SOLE_REPRESENTATION # e.g. OHG, GbR
- JOINT_REPRESENTATION # e.g. community of heirs
HsOfficePersonType:
type: string
enum:
- NATURAL # a human
- LEGAL # e.g. Corp., Inc., AG, GmbH, eG
- SOLE_REPRESENTATION # e.g. OHG, GbR
- JOINT_REPRESENTATION # e.g. community of heirs
HsOfficePerson:
type: object
properties:
personType:
uuid:
type: string
enum:
- NATURAL # a human
- LEGAL # e.g. Corp., Inc., AG, GmbH, eG
- SOLE_REPRESENTATION # e.g. OHG, GbR
- JOINT_REPRESENTATION # e.g. community of heirs
format: uuid
personType:
$ref: '#/components/schemas/HsOfficePersonType'
tradeName:
type: string
givenName:
@ -20,14 +32,32 @@ components:
familyName:
type: string
HsOfficePerson:
allOf:
- type: object
properties:
uuid:
type: string
format: uuid
- $ref: '#/components/schemas/HsOfficePersonBase'
HsOfficePersonInsert:
type: object
properties:
personType:
$ref: '#/components/schemas/HsOfficePersonType'
tradeName:
type: string
givenName:
type: string
familyName:
type: string
required:
- personType
HsOfficePersonUpdate:
$ref: '#/components/schemas/HsOfficePersonBase'
HsOfficePersonPatch:
type: object
properties:
personType:
nullable: true
$ref: '#/components/schemas/HsOfficePersonType'
tradeName:
type: string
nullable: true
givenName:
type: string
nullable: true
familyName:
type: string
nullable: true

View File

@ -0,0 +1,83 @@
get:
tags:
- hs-office-persons
description: 'Fetch a single business person by its uuid, if visible for the current subject.'
operationId: getPersonByUuid
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: personUUID
in: path
required: true
schema:
type: string
format: uuid
description: UUID of the person to fetch.
responses:
"200":
description: OK
content:
'application/json':
schema:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
patch:
tags:
- hs-office-persons
description: 'Updates a single person by its uuid, if permitted for the current subject.'
operationId: patchPerson
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: personUUID
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
'application/json':
schema:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePersonPatch'
responses:
"200":
description: OK
content:
'application/json':
schema:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
delete:
tags:
- hs-office-persons
description: 'Delete a single business person by its uuid, if permitted for the current subject.'
operationId: deletePersonByUuid
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: personUUID
in: path
required: true
schema:
type: string
format: uuid
description: UUID of the person to delete.
responses:
"204":
description: No Content
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
"404":
$ref: './error-responses.yaml#/components/responses/NotFound'

View File

@ -0,0 +1,56 @@
get:
summary: Returns a list of (optionally filtered) persons.
description: Returns the list of (optionally filtered) persons which are visible to the current user or any of it's assumed roles.
tags:
- hs-office-persons
operationId: listPersons
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: name
in: query
required: false
schema:
type: string
description: Prefix of label to filter the results.
responses:
"200":
description: OK
content:
'application/json':
schema:
type: array
items:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
post:
summary: Adds a new person.
tags:
- hs-office-persons
operationId: addPerson
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
requestBody:
content:
'application/json':
schema:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePersonInsert'
required: true
responses:
"201":
description: Created
content:
'application/json':
schema:
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
"409":
$ref: './error-responses.yaml#/components/responses/Conflict'

View File

@ -25,3 +25,12 @@ paths:
/api/hs/office/contacts/{contactUUID}:
$ref: "./hs-office-contacts-with-uuid.yaml"
# Persons
/api/hs/office/persons:
$ref: "./hs-office-persons.yaml"
/api/hs/office/persons/{personUUID}:
$ref: "./hs-office-persons-with-uuid.yaml"