feat(api): add TrainingDate routes, schemas, responses, parameters, etc.
This commit is contained in:
parent
4bf2ae4a06
commit
9cd3b7d9fe
1 changed files with 216 additions and 0 deletions
|
|
@ -120,6 +120,118 @@ paths:
|
||||||
"500":
|
"500":
|
||||||
$ref: "#/components/responses/InternalError"
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
|
/v1/trainings/{trainingID}/dates:
|
||||||
|
get:
|
||||||
|
summary: List all dates of a training
|
||||||
|
operationId: listTrainingDates
|
||||||
|
tags:
|
||||||
|
- Trainings
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/TrainingID"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: List of training dates
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ListTrainingDatesResponse"
|
||||||
|
"404":
|
||||||
|
$ref: "#/components/responses/NotFoundError"
|
||||||
|
|
||||||
|
"500":
|
||||||
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Create a new training date
|
||||||
|
operationId: createTrainingDate
|
||||||
|
tags:
|
||||||
|
- Trainings
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/TrainingID"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateTrainingDateRequest"
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: Training date created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateTrainingDateResponse"
|
||||||
|
"400":
|
||||||
|
$ref: "#/components/responses/InvalidInputError"
|
||||||
|
"500":
|
||||||
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
|
/v1/trainings/{trainingID}/dates/{trainingDateID}:
|
||||||
|
get:
|
||||||
|
summary: Get a training date by ID
|
||||||
|
operationId: getTrainingDate
|
||||||
|
tags:
|
||||||
|
- Trainings
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/TrainingID"
|
||||||
|
- $ref: "#/components/parameters/TrainingDateID"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: List of training dates
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/GetTrainingDateResponse"
|
||||||
|
"404":
|
||||||
|
$ref: "#/components/responses/NotFoundError"
|
||||||
|
|
||||||
|
"500":
|
||||||
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
|
put:
|
||||||
|
summary: Update a training date by ID
|
||||||
|
operationId: updateTrainingDate
|
||||||
|
tags:
|
||||||
|
- Trainings
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/TrainingID"
|
||||||
|
- $ref: "#/components/parameters/TrainingDateID"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/UpdateTrainingDateRequest"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Training date updated
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/UpdateTrainingDateResponse"
|
||||||
|
"400":
|
||||||
|
$ref: "#/components/responses/InvalidInputError"
|
||||||
|
"404":
|
||||||
|
$ref: "#/components/responses/NotFoundError"
|
||||||
|
"500":
|
||||||
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
|
delete:
|
||||||
|
summary: Delete a training date by ID
|
||||||
|
operationId: deleteTrainingDate
|
||||||
|
tags:
|
||||||
|
- Trainings
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/TrainingID"
|
||||||
|
- $ref: "#/components/parameters/TrainingDateID"
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: Training date deleted
|
||||||
|
"404":
|
||||||
|
$ref: "#/components/responses/NotFoundError"
|
||||||
|
"500":
|
||||||
|
$ref: "#/components/responses/InternalError"
|
||||||
|
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
TrainingID:
|
TrainingID:
|
||||||
|
|
@ -129,6 +241,13 @@ components:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/TrainingID"
|
$ref: "#/components/schemas/TrainingID"
|
||||||
description: Training ID
|
description: Training ID
|
||||||
|
TrainingDateID:
|
||||||
|
in: path
|
||||||
|
name: trainingDateID
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/TrainingDateID"
|
||||||
|
description: Training Date ID
|
||||||
|
|
||||||
schemas:
|
schemas:
|
||||||
CreateTrainingRequest:
|
CreateTrainingRequest:
|
||||||
|
|
@ -218,6 +337,103 @@ components:
|
||||||
- amount
|
- amount
|
||||||
- type
|
- type
|
||||||
|
|
||||||
|
CreateTrainingDateRequest:
|
||||||
|
$ref: "#/components/schemas/NewTrainingDate"
|
||||||
|
|
||||||
|
CreateTrainingDateResponse:
|
||||||
|
$ref: "#/components/schemas/TrainingDate"
|
||||||
|
|
||||||
|
ListTrainingDatesResponse:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/TrainingDate"
|
||||||
|
|
||||||
|
GetTrainingDateResponse:
|
||||||
|
$ref: "#/components/schemas/TrainingDate"
|
||||||
|
|
||||||
|
UpdateTrainingDateRequest:
|
||||||
|
$ref: "#/components/schemas/NewTrainingDate"
|
||||||
|
|
||||||
|
UpdateTrainingDateResponse:
|
||||||
|
$ref: "#/components/schemas/TrainingDate"
|
||||||
|
|
||||||
|
NewTrainingDate:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
date:
|
||||||
|
type: string
|
||||||
|
format: date
|
||||||
|
x-go-type: time.Time
|
||||||
|
startTime:
|
||||||
|
type: string
|
||||||
|
format: time
|
||||||
|
days:
|
||||||
|
type: integer
|
||||||
|
format: int8
|
||||||
|
minimum: 1
|
||||||
|
maximum: 5
|
||||||
|
isOnline:
|
||||||
|
type: boolean
|
||||||
|
location:
|
||||||
|
type: string
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
capacity:
|
||||||
|
type: integer
|
||||||
|
format: int8
|
||||||
|
minimum: 1
|
||||||
|
price:
|
||||||
|
$ref: "#/components/schemas/TrainingDatePrice"
|
||||||
|
required:
|
||||||
|
- trainingID
|
||||||
|
- date
|
||||||
|
- startTime
|
||||||
|
- days
|
||||||
|
- isOnline
|
||||||
|
- location
|
||||||
|
- address
|
||||||
|
- capacity
|
||||||
|
- price
|
||||||
|
|
||||||
|
TrainingDate:
|
||||||
|
allOf:
|
||||||
|
- $ref: "#/components/schemas/NewTrainingDate"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
$ref: "#/components/schemas/TrainingDateID"
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
|
||||||
|
TrainingDatePrice:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
currency:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- CZK
|
||||||
|
- EUR
|
||||||
|
- USD
|
||||||
|
x-go-type: currency.Currency
|
||||||
|
x-go-type-package:
|
||||||
|
path: gitlab.mareshq.com/hq/yggdrasil/internal/currency
|
||||||
|
amount:
|
||||||
|
type: number
|
||||||
|
minimum: 0
|
||||||
|
x-go-type: decimal.Decimal
|
||||||
|
x-go-type-package:
|
||||||
|
path: github.com/shopspring/decimal
|
||||||
|
required:
|
||||||
|
- currency
|
||||||
|
- amount
|
||||||
|
|
||||||
|
TrainingDateID:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
x-go-type: training.TrainingDateID
|
||||||
|
x-go-type-import:
|
||||||
|
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||||
|
|
||||||
ProblemDetails:
|
ProblemDetails:
|
||||||
type: object
|
type: object
|
||||||
description: >
|
description: >
|
||||||
|
|
|
||||||
Reference in a new issue