1
0

hs.admin.partner from API via Controller to Entity

This commit is contained in:
Michael Hoennig
2022-09-06 11:07:08 +02:00
parent 2abe88eb15
commit af90fefd49
27 changed files with 1194 additions and 18 deletions

View File

@ -0,0 +1,16 @@
openapi-processor-mapping: v2
options:
package-name: net.hostsharing.hsadminng.hs.admin.generated.api.v1
model-name-suffix: Resource
map:
result: org.springframework.http.ResponseEntity
types:
- type: array => java.util.List
- type: string:uuid => java.util.UUID
paths:
/api/hs/admin/partners/{packageUUID}:
null: org.openapitools.jackson.nullable.JsonNullable

View File

@ -0,0 +1 @@
../auth.yaml

View File

@ -0,0 +1 @@
../error-responses.yaml

View File

@ -0,0 +1,28 @@
components:
schemas:
HsAdminContactBase:
type: object
properties:
label:
type: string
postalAddress:
type: string
emailAddresses:
type: string
phoneNumbers:
type: string
HsAdminContact:
allOf:
- type: object
properties:
uuid:
type: string
format: uuid
- $ref: '#/components/schemas/HsAdminContactBase'
HsAdminContactUpdate:
$ref: '#/components/schemas/HsAdminContactBase'

View File

@ -0,0 +1,45 @@
components:
schemas:
HsAdminPartnerBase:
type: object
properties:
registrationOffice:
type: string
registrationNumber:
type: string
birthName:
type: string
birthday:
type: string
format: date
dateOfDeath:
type: string
format: date
HsAdminPartner:
allOf:
- type: object
properties:
uuid:
type: string
format: uuid
person:
$ref: './hs-admin-person-schemas.yaml#/components/schemas/HsAdminPerson'
contact:
$ref: './hs-admin-contact-schemas.yaml#/components/schemas/HsAdminContact'
- $ref: '#/components/schemas/HsAdminPartnerBase'
HsAdminPartnerUpdate:
allOf:
- type: object
properties:
personUuid:
type: string
format: uuid
contactUuid:
type: string
format: uuid
- $ref: '#/components/schemas/HsAdminPartnerBase'

View File

@ -0,0 +1,81 @@
get:
tags:
- hs-admin-partners
description: 'Fetch a single business partner by its uuid, if visible for the current subject.'
operationId: getPartnerByUuid
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: partnerUUID
in: path
required: true
schema:
type: string
format: uuid
responses:
"200":
description: OK
content:
'application/json':
schema:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartner'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
patch:
tags:
- hs-admin-partners
operationId: updatePartner
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: partnerUUID
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
'application/json':
schema:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartnerUpdate'
responses:
"200":
description: OK
content:
'application/json':
schema:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartner'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
delete:
tags:
- hs-admin-partners
operationId: deletePartnerByUuid
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: userUuid
in: path
required: true
schema:
type: string
format: uuid
description: UUID of the user 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) business partners.
description: Returns the list of (optionally filtered) business partners which are visible to the current user or any of it's assumed roles.
tags:
- hs-admin-partners
operationId: listPartners
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
- name: name
in: query
required: false
schema:
type: string
description: Customer-prefix to filter the results. TODO
responses:
"200":
description: OK
content:
'application/json':
schema:
type: array
items:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartner'
"401":
$ref: './error-responses.yaml#/components/responses/Unauthorized'
"403":
$ref: './error-responses.yaml#/components/responses/Forbidden'
post:
summary: Adds a new business partner.
tags:
- hs-admin-partners
operationId: addPartner
parameters:
- $ref: './auth.yaml#/components/parameters/currentUser'
- $ref: './auth.yaml#/components/parameters/assumedRoles'
requestBody:
content:
'application/json':
schema:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartner'
required: true
responses:
"201":
description: Created
content:
'application/json':
schema:
$ref: './hs-admin-partner-schemas.yaml#/components/schemas/HsAdminPartner'
"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

@ -0,0 +1,33 @@
components:
schemas:
HsAdminPersonBase:
type: object
properties:
personType:
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
tradeName:
type: string
givenName:
type: string
familyName:
type: string
HsAdminPerson:
allOf:
- type: object
properties:
uuid:
type: string
format: uuid
- $ref: '#/components/schemas/HsAdminPersonBase'
HsAdminPersonUpdate:
$ref: '#/components/schemas/HsAdminPersonBase'

View File

@ -0,0 +1,16 @@
openapi: 3.0.1
info:
title: Hostsharing hsadmin-ng API
version: v0
servers:
- url: http://localhost:8080
description: Local development default URL.
paths:
/api/hs/admin/partners:
$ref: "./hs-admin-partners.yaml"
/api/hs/admin/partners/{partnerUUID}:
$ref: "./hs-admin-partners-with-uuid.yaml"