feat(api): add routes for handling training date attendees
This commit is contained in:
parent
1fe2867b05
commit
c9c47fbcbf
1 changed files with 225 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
openapi: "3.1.0"
|
||||
openapi: "3.0.0"
|
||||
info:
|
||||
version: "0.1.0"
|
||||
title: MaresHQ API
|
||||
|
|
@ -74,7 +74,6 @@ paths:
|
|||
$ref: "#/components/schemas/GetTrainingResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
|
|
@ -137,7 +136,6 @@ paths:
|
|||
$ref: "#/components/schemas/ListTrainingDatesResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
|
|
@ -184,7 +182,6 @@ paths:
|
|||
$ref: "#/components/schemas/GetTrainingDateResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
|
|
@ -272,6 +269,142 @@ paths:
|
|||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
/v1/trainings/{trainingID}/dates/{trainingDateID}/attendees:
|
||||
get:
|
||||
summary: List all attendees of a training date
|
||||
operationId: listTrainingDateAttendees
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
responses:
|
||||
"200":
|
||||
description: List of training date attendees
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ListTrainingDateAttendeesResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
post:
|
||||
summary: Create a new training date attendee
|
||||
operationId: createTrainingDateAttendee
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateTrainingDateAttendeeRequest"
|
||||
responses:
|
||||
"201":
|
||||
description: Training date attendee created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateTrainingDateAttendeeResponse"
|
||||
"400":
|
||||
$ref: "#/components/responses/InvalidInputError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
/v1/trainings/{trainingID}/dates/{trainingDateID}/attendees/{trainingDateAttendeeID}:
|
||||
get:
|
||||
summary: Get a training date attendee by ID
|
||||
operationId: getTrainingDateAttendee
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
- $ref: "#/components/parameters/TrainingDateAttendeeID"
|
||||
responses:
|
||||
"200":
|
||||
description: Training date attendee
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GetTrainingDateAttendeeResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
put:
|
||||
summary: Update a training date attendee by ID
|
||||
operationId: updateTrainingDateAttendee
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
- $ref: "#/components/parameters/TrainingDateAttendeeID"
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UpdateTrainingDateAttendeeRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Training date attendee updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UpdateTrainingDateAttendeeResponse"
|
||||
"400":
|
||||
$ref: "#/components/responses/InvalidInputError"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
delete:
|
||||
summary: Delete a training date attendee by ID
|
||||
operationId: deleteTrainingDateAttendee
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
- $ref: "#/components/parameters/TrainingDateAttendeeID"
|
||||
responses:
|
||||
"204":
|
||||
description: Training date attendee deleted
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
/v1/trainings/{trainingID}/dates/{trainingDateID}/attendees/count:
|
||||
get:
|
||||
summary: Get a training date attendee count
|
||||
operationId: getTrainingDateAttendeeCount
|
||||
tags:
|
||||
- Trainings
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TrainingID"
|
||||
- $ref: "#/components/parameters/TrainingDateID"
|
||||
responses:
|
||||
"200":
|
||||
description: Count of training date attendees
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/GetTrainingDateAttendeeCountResponse"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFoundError"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
components:
|
||||
parameters:
|
||||
TrainingID:
|
||||
|
|
@ -281,6 +414,7 @@ components:
|
|||
schema:
|
||||
$ref: "#/components/schemas/TrainingID"
|
||||
description: Training ID
|
||||
|
||||
TrainingDateID:
|
||||
in: path
|
||||
name: trainingDateID
|
||||
|
|
@ -288,6 +422,13 @@ components:
|
|||
schema:
|
||||
$ref: "#/components/schemas/TrainingDateID"
|
||||
description: Training Date ID
|
||||
TrainingDateAttendeeID:
|
||||
in: path
|
||||
name: trainingDateAttendeeID
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/TrainingDateAttendeeID"
|
||||
description: Training Date Attendee ID
|
||||
|
||||
schemas:
|
||||
CreateTrainingRequest:
|
||||
|
|
@ -457,6 +598,86 @@ components:
|
|||
x-go-type-import:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||
|
||||
CreateTrainingDateAttendeeRequest:
|
||||
$ref: "#/components/schemas/NewTrainingDateAttendee"
|
||||
|
||||
CreateTrainingDateAttendeeResponse:
|
||||
$ref: "#/components/schemas/TrainingDateAttendee"
|
||||
|
||||
ListTrainingDateAttendeesResponse:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/TrainingDateAttendee"
|
||||
|
||||
GetTrainingDateAttendeeResponse:
|
||||
$ref: "#/components/schemas/TrainingDateAttendee"
|
||||
|
||||
UpdateTrainingDateAttendeeRequest:
|
||||
$ref: "#/components/schemas/NewTrainingDateAttendee"
|
||||
|
||||
UpdateTrainingDateAttendeeResponse:
|
||||
$ref: "#/components/schemas/TrainingDateAttendee"
|
||||
|
||||
GetTrainingDateAttendeeCountResponse:
|
||||
type: object
|
||||
properties:
|
||||
count:
|
||||
type: integer
|
||||
format: int8
|
||||
minimum: 0
|
||||
required:
|
||||
- count
|
||||
|
||||
TrainingDateAttendeeID:
|
||||
type: string
|
||||
format: uuid
|
||||
x-go-type: training.TrainingDateAttendeeID
|
||||
x-go-type-import:
|
||||
path: gitlab.mareshq.com/hq/yggdrasil/pkg/training
|
||||
|
||||
NewTrainingDateAttendee:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
phone:
|
||||
type: string
|
||||
company:
|
||||
type: string
|
||||
position:
|
||||
type: string
|
||||
bill:
|
||||
$ref: "#/components/schemas/Price"
|
||||
isStudent:
|
||||
type: boolean
|
||||
default: false
|
||||
hasPaid:
|
||||
type: boolean
|
||||
default: false
|
||||
hasAttended:
|
||||
type: boolean
|
||||
default: false
|
||||
required:
|
||||
- name
|
||||
- email
|
||||
- phone
|
||||
- company
|
||||
- position
|
||||
- bill
|
||||
|
||||
TrainingDateAttendee:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/NewTrainingDateAttendee"
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/TrainingDateAttendeeID"
|
||||
required:
|
||||
- id
|
||||
|
||||
Price:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
Reference in a new issue