1
0
Fork 0
This repository has been archived on 2025-08-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-backoffice-v2-api/api/v1/openapi.yaml

841 lines
23 KiB
YAML

openapi: "3.1.0"
info:
version: 1.3.0
title: Backoffice API
license:
name: Proprietary
contact:
name: Vojtěch Mareš
email: iam@vojtechmares.com
url: https://www.vojtechmares.com
servers:
- url: http://localhost:8080/v1
description: Local development server
- url: https://api.backoffice.staging.mareshq.com/v1
description: Staging server
- url: https://api.backoffice.mareshq.com/v1
description: Production server
paths:
/trainings:
get:
summary: List all trainings
operationId: listTrainings
tags:
- trainings
responses:
"200":
description: A list of trainings
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Training"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Create a new training
operationId: createTraining
tags:
- trainings
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTraining"
responses:
"201":
description: Training created
content:
application/json:
schema:
$ref: "#/components/schemas/Training"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}:
get:
summary: Get a training by ID
operationId: getTraining
tags:
- trainings
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"200":
description: A training
content:
application/json:
schema:
$ref: "#/components/schemas/Training"
"404":
description: Training not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
put:
summary: Update a training by ID
operationId: updateTraining
tags:
- trainings
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTraining"
responses:
"200":
description: Training updated
content:
application/json:
schema:
$ref: "#/components/schemas/Training"
"404":
description: Training not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
delete:
summary: Delete a training by ID
operationId: deleteTraining
tags:
- trainings
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"204":
description: Training deleted
"404":
description: Training not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates:
get:
summary: List all dates of a training
operationId: listTrainingDates
tags:
- training dates
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"200":
description: A list of dates
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TrainingDate"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Create a new date for a training
operationId: createTrainingDate
tags:
- training dates
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTrainingDate"
responses:
"201":
description: Date created
content:
application/json:
schema:
$ref: "#/components/schemas/TrainingDate"
"409":
description: Date already exists
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}:
delete:
summary: Delete a date of a training
operationId: deleteTrainingDate
tags:
- training dates
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"204":
description: Date deleted
"404":
description: Date not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
put:
summary: Update a date of a training
operationId: updateTrainingDate
tags:
- training dates
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTrainingDate"
responses:
"200":
description: Date updated
content:
application/json:
schema:
$ref: "#/components/schemas/TrainingDate"
"404":
description: Date not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"400":
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees:
get:
summary: List all attendees of a date of a training
operationId: listTrainingDateAttendees
tags:
- training dates attendees
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"200":
description: A list of attendees
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TrainingDateAttendee"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
post:
summary: Add an attendee to a date of a training
operationId: createTrainingDateAttendee
tags:
- training dates attendees
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTrainingDateAttendee"
responses:
"201":
description: Attendee created
content:
application/json:
schema:
$ref: "#/components/schemas/TrainingDateAttendee"
"409":
description: Attendee already exists (attendee already registered for this date)
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}:
delete:
summary: Delete an attendee of a date of a training
operationId: deleteTrainingDateAttendee
tags:
- training dates attendees
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: attendeeID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.AttendeeID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"204":
description: Attendee deleted
"404":
description: Attendee not found
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}/feedback:
post:
summary: Submit feedback for an attendee of a date of a training
operationId: createTrainingDateAttendeeFeedback
tags:
- training attendee feedback
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: attendeeID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.AttendeeID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewTrainingFeedback"
responses:
"201":
description: Feedback created
content:
application/json:
schema:
$ref: "#/components/schemas/TrainingFeedback"
"409":
description: Feedback already submitted
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/dates/{dateID}/feedback:
get:
summary: List all feedback of a date of a training
operationId: listTrainingDateFeedback
tags:
- training attendee feedback
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
- name: dateID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"200":
description: A list of feedback
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TrainingFeedback"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/{trainingID}/feedback:
get:
summary: List all feedback of a training
operationId: listTrainingFeedback
tags:
- training attendee feedback
parameters:
- name: trainingID
in: path
required: true
schema:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
responses:
"200":
description: A list of feedback
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/TrainingFeedback"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/trainings/upcoming-dates:
get:
summary: List all upcoming dates of all trainings
operationId: listUpcomingTrainingDates
tags:
- training dates
parameters:
- name: from
in: query
required: false
schema:
type: string
format: date
- name: to
in: query
required: false
schema:
type: string
format: date
- name: limit
in: query
required: false
schema:
type: string
format: date
default: 10
responses:
"200":
description: A list of dates
content:
application/json:
schema:
type: array
items:
type: object
properties:
training:
$ref: "#/components/schemas/Training"
date:
$ref: "#/components/schemas/TrainingDate"
"500":
description: Internal error
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
components:
schemas:
NewTraining:
type: object
properties:
name:
type: string
duration:
type: integer
format: int32
price:
type: object
properties:
open:
$ref: "#/components/schemas/Price"
corporate:
$ref: "#/components/schemas/Price"
length:
type: integer
format: int32
required:
- name
- duration
- price
Training:
allOf:
- $ref: "#/components/schemas/NewTraining"
- type: object
properties:
id:
type: string
format: uuid
x-go-type: training.ID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
required:
- id
NewTrainingDate:
type: object
properties:
date:
type: string
format: date
capacity:
type: integer
format: int32
days:
type: integer
format: int32
location:
type: string
price:
$ref: "#/components/schemas/Price"
required:
- date
- capacity
- price
- days
- location
TrainingDate:
allOf:
- $ref: "#/components/schemas/NewTrainingDate"
- type: object
properties:
id:
type: string
format: uuid
x-go-type: training.DateID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
address:
type: string
required:
- id
NewTrainingDateAttendee:
type: object
properties:
name:
type: string
email:
type: string
required:
- name
- email
TrainingDateAttendee:
allOf:
- $ref: "#/components/schemas/NewTrainingDateAttendee"
- type: object
properties:
id:
type: string
format: uuid
x-go-type: training.AttendeeID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
company:
type: string
required:
- id
NewTrainingFeedback:
type: object
properties:
rating:
type: integer
format: int32
minimum: 0
maximum: 10
comment:
type: string
anonymous:
type: boolean
default: false
isSharingAllowed:
type: boolean
default: false
required:
- rating
- comment
TrainingFeedback:
allOf:
- $ref: "#/components/schemas/NewTrainingFeedback"
- type: object
properties:
id:
type: string
format: uuid
x-go-type: training.FeedbackID
x-go-type-import:
path: gitlab.mareshq.com/hq/backoffice/backoffice-api/pkg/training
required:
- id
Price:
type: object
properties:
currency:
type: string
enum: [CZK, EUR, USD]
amount:
type: number
format: float
minimum: 0
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