openapi: "3.1.0" info: version: "0.1.0" title: MaresHQ API license: name: Proprietary contact: name: Vojtěch Mareš email: iam@vojtechmares.com url: https://www.vojtechmares.com servers: - url: http://localhost:3000 description: Local development server tags: - name: Trainings description: Operations about trainings paths: /v1/trainings: get: summary: List all trainings operationId: listTrainings tags: - Trainings responses: "200": description: A list of trainings content: application/json: schema: $ref: "#/components/schemas/ListTrainingsResponse" "500": $ref: "#/components/responses/InternalError" post: summary: Create a new training operationId: createTraining tags: - Trainings requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTrainingRequest" responses: "201": description: Training created content: application/json: schema: $ref: "#/components/schemas/CreateTrainingResponse" "400": $ref: "#/components/responses/InvalidInputError" "500": $ref: "#/components/responses/InternalError" /v1/trainings/{trainingID}: get: summary: Get a training by ID operationId: getTraining tags: - Trainings parameters: - $ref: "#/components/parameters/TrainingID" responses: "200": description: A training content: application/json: schema: $ref: "#/components/schemas/GetTrainingResponse" "404": $ref: "#/components/responses/NotFoundError" "500": $ref: "#/components/responses/InternalError" put: summary: Update a training by ID operationId: updateTraining tags: - Trainings parameters: - $ref: "#/components/parameters/TrainingID" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateTrainingRequest" responses: "200": description: Training updated content: application/json: schema: $ref: "#/components/schemas/UpdateTrainingResponse" "400": $ref: "#/components/responses/InvalidInputError" "404": $ref: "#/components/responses/NotFoundError" "500": $ref: "#/components/responses/InternalError" delete: summary: Delete a training by ID operationId: deleteTraining tags: - Trainings parameters: - $ref: "#/components/parameters/TrainingID" responses: "204": description: Training deleted "404": $ref: "#/components/responses/NotFoundError" "500": $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: parameters: TrainingID: in: path name: trainingID required: true schema: $ref: "#/components/schemas/TrainingID" description: Training ID TrainingDateID: in: path name: trainingDateID required: true schema: $ref: "#/components/schemas/TrainingDateID" description: Training Date ID schemas: CreateTrainingRequest: $ref: "#/components/schemas/NewTraining" CreateTrainingResponse: $ref: "#/components/schemas/Training" ListTrainingsResponse: type: array items: $ref: "#/components/schemas/Training" GetTrainingResponse: $ref: "#/components/schemas/Training" UpdateTrainingRequest: $ref: "#/components/schemas/NewTraining" UpdateTrainingResponse: $ref: "#/components/schemas/Training" NewTraining: type: object properties: name: type: string days: type: integer format: int8 minimum: 1 maximum: 5 description: type: string pricing: type: array items: $ref: "#/components/schemas/TrainingPrice" required: - name - days - description - pricing Training: allOf: - $ref: "#/components/schemas/NewTraining" - type: object properties: id: $ref: "#/components/schemas/TrainingID" required: - id TrainingID: type: string format: uuid x-go-type: training.TrainingID x-go-type-import: path: gitlab.mareshq.com/hq/yggdrasil/pkg/training TrainingPrice: 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 type: type: string enum: - OPEN - CORPORATE required: - currency - amount - 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: type: object description: > Schema that carries the details of an error in an HTTP response. See https://datatracker.ietf.org/doc/html/rfc7807 for more information. properties: type: type: string description: A URI reference that identifies the problem type. title: type: string description: A human-readable summary of the problem type. status: type: integer description: The HTTP status code generated by the origin server for this occurrence of the problem. detail: type: string description: A human-readable explanation specific to this occurrence of the problem. instance: type: string description: A URI reference that identifies the specific occurrence of the problem. required: - type - title - status - detail - instance responses: InvalidInputError: description: Invalid input error content: application/problem+json: schema: $ref: "#/components/schemas/ProblemDetails" InternalError: description: Internal error content: application/problem+json: schema: $ref: "#/components/schemas/ProblemDetails" NotFoundError: description: Not found error content: application/problem+json: schema: $ref: "#/components/schemas/ProblemDetails"