feat: add v1 openapi spec
This commit is contained in:
parent
491eaba395
commit
f679dff15d
1 changed files with 658 additions and 0 deletions
658
api/v1/openapi.yaml
Normal file
658
api/v1/openapi.yaml
Normal file
|
|
@ -0,0 +1,658 @@
|
|||
openapi: "3.1.0"
|
||||
info:
|
||||
version: 1.0.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
|
||||
responses:
|
||||
"200":
|
||||
description: A list of trainings
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Training"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
post:
|
||||
summary: Create a new training
|
||||
operationId: createTraining
|
||||
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/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
/trainings/{trainingID}:
|
||||
get:
|
||||
summary: Get a training by ID
|
||||
operationId: getTraining
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
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/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
put:
|
||||
summary: Update a training by ID
|
||||
operationId: updateTraining
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
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/Error"
|
||||
"400":
|
||||
description: Invalid input
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
delete:
|
||||
summary: Delete a training by ID
|
||||
operationId: deleteTraining
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"204":
|
||||
description: Training deleted
|
||||
"404":
|
||||
description: Training not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates:
|
||||
get:
|
||||
summary: List all dates of a training
|
||||
operationId: listTrainingDates
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"200":
|
||||
description: A list of dates
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/TrainingDate"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
post:
|
||||
summary: Create a new date for a training
|
||||
operationId: createTrainingDate
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
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/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates/{dateID}:
|
||||
delete:
|
||||
summary: Delete a date of a training
|
||||
operationId: deleteTrainingDate
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: dateID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"204":
|
||||
description: Date deleted
|
||||
"404":
|
||||
description: Date not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates/{dateID}/attendees:
|
||||
get:
|
||||
summary: List all attendees of a date of a training
|
||||
operationId: listTrainingDateAttendees
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: dateID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"200":
|
||||
description: A list of attendees
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/TrainingDateAttendee"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
post:
|
||||
summary: Add an attendee to a date of a training
|
||||
operationId: createTrainingDateAttendee
|
||||
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/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}:
|
||||
delete:
|
||||
summary: Delete an attendee of a date of a training
|
||||
operationId: deleteTrainingDateAttendee
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: dateID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: attendeeID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"204":
|
||||
description: Attendee deleted
|
||||
"404":
|
||||
description: Attendee not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates/{dateID}/attendees/{attendeeID}/feedback:
|
||||
post:
|
||||
summary: Submit feedback for an attendee of a date of a training
|
||||
operationId: createTrainingDateAttendeeFeedback
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: dateID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: attendeeID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
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/Error"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/dates/{dateID}/feedback:
|
||||
get:
|
||||
summary: List all feedback of a date of a training
|
||||
operationId: listTrainingDateFeedback
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: dateID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"200":
|
||||
description: A list of feedback
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
$ref: "#/components/schemas/TrainingFeedback"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/{trainingID}/feedback:
|
||||
get:
|
||||
summary: List all feedback of a training
|
||||
operationId: listTrainingFeedback
|
||||
parameters:
|
||||
- name: trainingID
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
"200":
|
||||
description: A list of feedback
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
$ref: "#/components/schemas/TrainingFeedback"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/trainings/upcoming-dates:
|
||||
get:
|
||||
summary: List all upcoming dates of all trainings
|
||||
operationId: listUpcomingTrainingDates
|
||||
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"
|
||||
default:
|
||||
description: Unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
components:
|
||||
schemas:
|
||||
NewTraining:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
duration:
|
||||
type: integer
|
||||
format: int32
|
||||
price:
|
||||
type: object
|
||||
properties:
|
||||
open:
|
||||
currency:
|
||||
type: string
|
||||
enum: [CZK, EUR, USD]
|
||||
amount:
|
||||
type: number
|
||||
format: float
|
||||
corporate:
|
||||
currency:
|
||||
type: string
|
||||
enum: [CZK, EUR, USD]
|
||||
amount:
|
||||
type: number
|
||||
format: float
|
||||
minimum: 0
|
||||
length:
|
||||
type: number
|
||||
format: int32
|
||||
required:
|
||||
- name
|
||||
- duration
|
||||
- price
|
||||
Training:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Training"
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
required:
|
||||
- id
|
||||
|
||||
TrainingDate:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
date:
|
||||
type: string
|
||||
format: date
|
||||
capacity:
|
||||
type: integer
|
||||
format: int32
|
||||
price:
|
||||
type: object
|
||||
properties:
|
||||
currency:
|
||||
type: string
|
||||
enum: [CZK, EUR, USD]
|
||||
amount:
|
||||
type: number
|
||||
format: float
|
||||
required:
|
||||
- date
|
||||
- capacity
|
||||
- price
|
||||
|
||||
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
|
||||
required:
|
||||
- id
|
||||
|
||||
TrainingFeedback:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
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
|
||||
|
||||
Error:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
Reference in a new issue