refactor(api): standardize Swagger documentation

This commit is contained in:
Dominik 2025-06-17 22:11:22 +02:00
parent c7b7d61cec
commit 0a37848615
Signed by: dominik
GPG key ID: 06A4003FC5049644
7 changed files with 287 additions and 302 deletions

View file

@ -22,7 +22,7 @@ const postEventSchema = z
* summary: Get all events for the authenticated user
* description: Returns all events where the user is an organizer or a participant.
* tags:
* - Event
* - Event
* responses:
* 200:
* description: List of events for the user.
@ -36,13 +36,13 @@ const postEventSchema = z
* events:
* type: array
* items:
* $ref: '#/components/schemas/Event'
* $ref: "#/components/schemas/Event"
* 401:
* description: Not authenticated.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
* $ref: "#/components/schemas/ErrorResponse"
* example:
* success: false
* message: Not authenticated
@ -51,7 +51,7 @@ const postEventSchema = z
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
* $ref: "#/components/schemas/ErrorResponse"
* example:
* success: false
* message: User not found
@ -130,7 +130,7 @@ export const GET = auth(async (req) => {
* summary: Create a new event
* description: Creates a new event as the authenticated user (organizer).
* tags:
* - Event
* - Event
* requestBody:
* required: true
* content:
@ -165,22 +165,19 @@ export const GET = auth(async (req) => {
* success:
* type: boolean
* event:
* $ref: '#/components/schemas/Event'
* $ref: "#/components/schemas/Event"
* 400:
* description: Bad request due to invalid input data.
* description: Invalid request data.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
* example:
* success: false
* message: 'Invalid input data'
* application/json:
* schema:
* $ref: "#/components/schemas/ZodErrorResponse"
* 401:
* description: Not authenticated.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
* $ref: "#/components/schemas/ErrorResponse"
* example:
* success: false
* message: Not authenticated
@ -189,7 +186,7 @@ export const GET = auth(async (req) => {
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
* $ref: "#/components/schemas/ErrorResponse"
* example:
* success: false
* message: User not found