diff --git a/src/main/resources/api-definition/hs-office/hs-office-relations-schemas.yaml b/src/main/resources/api-definition/hs-office/hs-office-relations-schemas.yaml new file mode 100644 index 00000000..b092cd0a --- /dev/null +++ b/src/main/resources/api-definition/hs-office/hs-office-relations-schemas.yaml @@ -0,0 +1,65 @@ + +components: + + schemas: + + HsOfficeRelationType: + type: string + enum: + - UNKNOWN + - PARTNER + - EX_PARTNER + - DEBITOR + - REPRESENTATIVE + - VIP_CONTACT + - OPERATIONS + - SUBSCRIBER + + HsOfficeRelation: + type: object + properties: + uuid: + type: string + format: uuid + anchor: + $ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson' + holder: + $ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson' + type: + type: string + mark: + type: string + nullable: true + contact: + $ref: './hs-office-contact-schemas.yaml#/components/schemas/HsOfficeContact' + + HsOfficeRelationPatch: + type: object + properties: + contactUuid: + type: string + format: uuid + nullable: true + + HsOfficeRelationInsert: + type: object + properties: + anchorUuid: + type: string + format: uuid + holderUuid: + type: string + format: uuid + type: + type: string + nullable: true + mark: + type: string + contactUuid: + type: string + format: uuid + required: + - anchorUuid + - holderUuid + - type + - relContactUuid diff --git a/src/main/resources/api-definition/hs-office/hs-office-relations-with-uuid.yaml b/src/main/resources/api-definition/hs-office/hs-office-relations-with-uuid.yaml new file mode 100644 index 00000000..4511b895 --- /dev/null +++ b/src/main/resources/api-definition/hs-office/hs-office-relations-with-uuid.yaml @@ -0,0 +1,83 @@ +get: + tags: + - hs-office-relations + description: 'Fetch a single person relation by its uuid, if visible for the current subject.' + operationId: getRelationByUuid + parameters: + - $ref: './auth.yaml#/components/parameters/currentUser' + - $ref: './auth.yaml#/components/parameters/assumedRoles' + - name: relationUUID + in: path + required: true + schema: + type: string + format: uuid + description: UUID of the relation to fetch. + responses: + "200": + description: OK + content: + 'application/json': + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelation' + + "401": + $ref: './error-responses.yaml#/components/responses/Unauthorized' + "403": + $ref: './error-responses.yaml#/components/responses/Forbidden' + +patch: + tags: + - hs-office-relations + description: 'Updates a single person relation by its uuid, if permitted for the current subject.' + operationId: patchRelation + parameters: + - $ref: './auth.yaml#/components/parameters/currentUser' + - $ref: './auth.yaml#/components/parameters/assumedRoles' + - name: relationUUID + in: path + required: true + schema: + type: string + format: uuid + requestBody: + content: + 'application/json': + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelationPatch' + responses: + "200": + description: OK + content: + 'application/json': + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelation' + "401": + $ref: './error-responses.yaml#/components/responses/Unauthorized' + "403": + $ref: './error-responses.yaml#/components/responses/Forbidden' + +delete: + tags: + - hs-office-relations + description: 'Delete a single person relation by its uuid, if permitted for the current subject.' + operationId: deleteRelationByUuid + parameters: + - $ref: './auth.yaml#/components/parameters/currentUser' + - $ref: './auth.yaml#/components/parameters/assumedRoles' + - name: relationUUID + in: path + required: true + schema: + type: string + format: uuid + description: UUID of the relation 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' diff --git a/src/main/resources/api-definition/hs-office/hs-office-relations.yaml b/src/main/resources/api-definition/hs-office/hs-office-relations.yaml new file mode 100644 index 00000000..6328974f --- /dev/null +++ b/src/main/resources/api-definition/hs-office/hs-office-relations.yaml @@ -0,0 +1,63 @@ +get: + summary: Returns a list of (optionally filtered) person relations for a given person. + description: Returns the list of (optionally filtered) person relations of a given person and which are visible to the current user or any of it's assumed roles. + tags: + - hs-office-relations + operationId: listRelations + parameters: + - $ref: './auth.yaml#/components/parameters/currentUser' + - $ref: './auth.yaml#/components/parameters/assumedRoles' + - name: personUuid + in: query + required: true + schema: + type: string + format: uuid + description: Prefix of name properties from holder or contact to filter the results. + - name: relationType + in: query + required: false + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelationType' + description: Prefix of name properties from holder or contact to filter the results. + responses: + "200": + description: OK + content: + 'application/json': + schema: + type: array + items: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelation' + "401": + $ref: './error-responses.yaml#/components/responses/Unauthorized' + "403": + $ref: './error-responses.yaml#/components/responses/Forbidden' + +post: + summary: Adds a new person relation. + tags: + - hs-office-relations + operationId: addRelation + parameters: + - $ref: './auth.yaml#/components/parameters/currentUser' + - $ref: './auth.yaml#/components/parameters/assumedRoles' + requestBody: + content: + 'application/json': + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelationInsert' + required: true + responses: + "201": + description: Created + content: + 'application/json': + schema: + $ref: './hs-office-relations-schemas.yaml#/components/schemas/HsOfficeRelation' + "401": + $ref: './error-responses.yaml#/components/responses/Unauthorized' + "403": + $ref: './error-responses.yaml#/components/responses/Forbidden' + "409": + $ref: './error-responses.yaml#/components/responses/Conflict'