refactor(api): standardize Swagger documentation
Some checks failed
container-scan / Container Scan (pull_request) Failing after 1m29s
docker-build / docker (pull_request) Has been cancelled

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

View file

@ -14,7 +14,7 @@ export const patchParticipantSchema = z.object({
* summary: Get a specific participant's details in an event * summary: Get a specific participant's details in an event
* description: Returns the details of a specific participant in an event. * description: Returns the details of a specific participant in an event.
* tags: * tags:
* - Event_Participant * - Event_Participant
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -39,13 +39,13 @@ export const patchParticipantSchema = z.object({
* success: * success:
* type: boolean * type: boolean
* participant: * participant:
* $ref: '#/components/schemas/Participant' * $ref: "#/components/schemas/Participant"
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -54,7 +54,7 @@ export const patchParticipantSchema = z.object({
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User not found * message: User not found
@ -63,7 +63,7 @@ export const patchParticipantSchema = z.object({
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User is not a participant or organizer of this event * message: User is not a participant or organizer of this event
@ -158,7 +158,7 @@ export const GET = auth(async (req, { params }) => {
* summary: Remove a participant from an event * summary: Remove a participant from an event
* description: Removes a participant from an event. Only the organizer can remove participants. * description: Removes a participant from an event. Only the organizer can remove participants.
* tags: * tags:
* - Event_Participant * - Event_Participant
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -189,7 +189,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -198,7 +198,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User not found * message: User not found
@ -207,7 +207,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Only organizer can remove participants * message: Only organizer can remove participants
@ -292,7 +292,7 @@ export const DELETE = auth(async (req, { params }) => {
* summary: Update a participant's status in an event * summary: Update a participant's status in an event
* description: Updates the status of a participant in an event. Only the participant can update their own status. * description: Updates the status of a participant in an event. Only the participant can update their own status.
* tags: * tags:
* - Event_Participant * - Event_Participant
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -328,22 +328,19 @@ export const DELETE = auth(async (req, { params }) => {
* success: * success:
* type: boolean * type: boolean
* participant: * participant:
* $ref: '#/components/schemas/Participant' * $ref: "#/components/schemas/Participant"
* 400: * 400:
* description: Bad request due to invalid input data. * description: Invalid request data.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ZodErrorResponse"
* example:
* success: false
* message: 'Invalid input data'
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -352,7 +349,7 @@ export const DELETE = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User not found * message: User not found
@ -361,7 +358,7 @@ export const DELETE = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Only participant can update their status * message: Only participant can update their status

View file

@ -15,7 +15,7 @@ export const postParticipantSchema = z.object({
* summary: Get participants of an event * summary: Get participants of an event
* description: Returns all participants of a specific event. * description: Returns all participants of a specific event.
* tags: * tags:
* - Event_Participant * - Event_Participant
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -36,13 +36,13 @@ export const postParticipantSchema = z.object({
* participants: * participants:
* type: array * type: array
* items: * items:
* $ref: '#/components/schemas/Participant' * $ref: "#/components/schemas/Participant"
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -51,7 +51,7 @@ export const postParticipantSchema = z.object({
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User not found * message: User not found
@ -60,7 +60,7 @@ export const postParticipantSchema = z.object({
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User is not a participant or organizer of this event * message: User is not a participant or organizer of this event
@ -144,7 +144,7 @@ export const GET = auth(async (req, { params }) => {
* summary: Add a participant to an event * summary: Add a participant to an event
* description: Adds a user as a participant to a specific event. * description: Adds a user as a participant to a specific event.
* tags: * tags:
* - Event_Participant * - Event_Participant
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -173,22 +173,19 @@ export const GET = auth(async (req, { params }) => {
* success: * success:
* type: boolean * type: boolean
* participant: * participant:
* $ref: '#/components/schemas/Participant' * $ref: "#/components/schemas/Participant"
* 400: * 400:
* description: Bad request due to invalid input data. * description: Invalid request data.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ZodErrorResponse"
* example:
* success: false
* message: 'Invalid input data'
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -197,7 +194,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User not found * message: User not found
@ -206,7 +203,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Only organizers can add participants * message: Only organizers can add participants
@ -215,7 +212,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User is already a participant of this event * message: User is already a participant of this event

View file

@ -19,7 +19,7 @@ export const patchEventSchema = z.object({
* summary: Get details of a specific event * summary: Get details of a specific event
* description: Returns the details of an event by its ID. * description: Returns the details of an event by its ID.
* tags: * tags:
* - Event * - Event
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -38,13 +38,13 @@ export const patchEventSchema = z.object({
* success: * success:
* type: boolean * type: boolean
* event: * event:
* $ref: '#/components/schemas/Event' * $ref: "#/components/schemas/Event"
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -53,7 +53,7 @@ export const patchEventSchema = z.object({
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
*/ */
export const GET = auth(async (req, { params }) => { export const GET = auth(async (req, { params }) => {
if (!req.auth) if (!req.auth)
@ -140,7 +140,7 @@ export const GET = auth(async (req, { params }) => {
* summary: Delete a specific event * summary: Delete a specific event
* description: Deletes an event by its ID if the user is the organizer. * description: Deletes an event by its ID if the user is the organizer.
* tags: * tags:
* - Event * - Event
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -165,7 +165,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -174,7 +174,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: You are not the organizer of this event * message: You are not the organizer of this event
@ -183,7 +183,7 @@ export const GET = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
*/ */
export const DELETE = auth(async (req, { params }) => { export const DELETE = auth(async (req, { params }) => {
if (!req.auth) if (!req.auth)
@ -251,7 +251,7 @@ export const DELETE = auth(async (req, { params }) => {
* summary: Update a specific event * summary: Update a specific event
* description: Updates an event by its ID if the user is the organizer. * description: Updates an event by its ID if the user is the organizer.
* tags: * tags:
* - Event * - Event
* parameters: * parameters:
* - in: path * - in: path
* name: eventID * name: eventID
@ -292,22 +292,19 @@ export const DELETE = auth(async (req, { params }) => {
* success: * success:
* type: boolean * type: boolean
* event: * event:
* $ref: '#/components/schemas/Event' * $ref: "#/components/schemas/Event"
* 400: * 400:
* description: Bad request due to invalid input data. * description: Invalid request data.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ZodErrorResponse"
* example:
* success: false
* message: 'Invalid input data'
* 401: * 401:
* description: Not authenticated. * description: Not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: Not authenticated * message: Not authenticated
@ -316,7 +313,7 @@ export const DELETE = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: You are not the organizer of this event * message: You are not the organizer of this event
@ -325,7 +322,7 @@ export const DELETE = auth(async (req, { params }) => {
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: User or event not found * message: User or event not found

View file

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

View file

@ -17,85 +17,85 @@ export const getSearchUserSchema = z.object({
/** /**
* @swagger * @swagger
* /api/search/user: * /api/search/user:
* get: * get:
* summary: Search for users * summary: Search for users
* description: Search for users by name, first name, or last name with pagination and sorting. * description: Search for users by name, first name, or last name with pagination and sorting.
* tags: * tags:
* - Search * - Search
* parameters: * parameters:
* - in: query * - in: query
* name: query * name: query
* required: false * required: false
* schema: * schema:
* type: string * type: string
* description: The search query to filter users by name, first name, or last name. * description: The search query to filter users by name, first name, or last name.
* - in: query * - in: query
* name: count * name: count
* required: false * required: false
* schema: * schema:
* type: integer * type: integer
* description: The number of users to return per page (default is 10). * description: The number of users to return per page (default is 10).
* - in: query * - in: query
* name: page * name: page
* required: false * required: false
* schema: * schema:
* type: integer * type: integer
* description: The page number to return (default is 1). * description: The page number to return (default is 1).
* - in: query * - in: query
* name: sort_by * name: sort_by
* required: false * required: false
* schema: * schema:
* type: string * type: string
* enum: ['created_at', 'name', 'first_name', 'last_name', 'id'] * enum: ["created_at", "name", "first_name", "last_name", "id"]
* description: The field to sort by (default is 'created_at'). * description: The field to sort by (default is 'created_at').
* - in: query * - in: query
* name: sort_order * name: sort_order
* required: false * required: false
* schema: * schema:
* type: string * type: string
* enum: ['asc', 'desc'] * enum: ["asc", "desc"]
* description: The order to sort by, either 'asc' or 'desc' (default is 'desc'). * description: The order to sort by, either 'asc' or 'desc' (default is 'desc').
* responses: * responses:
* 200: * 200:
* description: Users found successfully. * description: Users found successfully.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * type: object
* properties: * properties:
* success: * success:
* type: boolean * type: boolean
* users: * users:
* type: array * type: array
* items: * items:
* $ref: '#/components/schemas/PublicUser' * $ref: "#/components/schemas/PublicUser"
* count: * count:
* type: integer * type: integer
* description: The number of users returned. * description: The number of users returned.
* 400: * 400:
* description: Invalid request data. * description: Invalid request data.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ZodErrorResponse' * $ref: "#/components/schemas/ZodErrorResponse"
* 401: * 401:
* description: User is not authenticated. * description: User is not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'Not authenticated' * message: "Not authenticated"
* 404: * 404:
* description: User not found. * description: User not found.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'User not found' * message: "User not found"
*/ */
export const GET = auth(async function GET(req) { export const GET = auth(async function GET(req) {
if (!req.auth) if (!req.auth)

View file

@ -5,49 +5,49 @@ import { prisma } from '@/prisma';
/** /**
* @swagger * @swagger
* /api/user/{user}: * /api/user/{user}:
* get: * get:
* summary: Get user information by ID or name * summary: Get user information by ID or name
* description: Retrieve the information of a specific user by ID or name. * description: Retrieve the information of a specific user by ID or name.
* tags: * tags:
* - User * - User
* parameters: * parameters:
* - in: path * - in: path
* name: user * name: user
* required: true * required: true
* schema: * schema:
* type: string * type: string
* description: The ID or name of the user to retrieve. * description: The ID or name of the user to retrieve.
* responses: * responses:
* 200: * 200:
* description: User information retrieved successfully. * description: User information retrieved successfully.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: 'object' * type: "object"
* properties: * properties:
* success: * success:
* type: 'boolean' * type: "boolean"
* default: true * default: true
* user: * user:
* $ref: '#/components/schemas/PublicUser' * $ref: "#/components/schemas/PublicUser"
* 401: * 401:
* description: User is not authenticated. * description: User is not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'Not authenticated' * message: "Not authenticated"
* 404: * 404:
* description: User not found. * description: User not found.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'User not found' * message: "User not found"
*/ */
export const GET = auth(async function GET(req, { params }) { export const GET = auth(async function GET(req, { params }) {
if (!req.auth) if (!req.auth)

View file

@ -21,42 +21,42 @@ export const patchUserMeSchema = z.object({
/** /**
* @swagger * @swagger
* /api/user/me: * /api/user/me:
* get: * get:
* summary: Get the currently authenticated user's information * summary: Get the currently authenticated user's information
* description: Retrieve the information of the currently authenticated user. * description: Retrieve the information of the currently authenticated user.
* tags: * tags:
* - User * - User
* responses: * responses:
* 200: * 200:
* description: User information retrieved successfully. * description: User information retrieved successfully.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * type: object
* properties: * properties:
* success: * success:
* type: boolean * type: boolean
* default: true * default: true
* user: * user:
* $ref: '#/components/schemas/User' * $ref: "#/components/schemas/User"
* 401: * 401:
* description: User is not authenticated. * description: User is not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'Not authenticated' * message: "Not authenticated"
* 404: * 404:
* description: User not found. * description: User not found.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'User not found' * message: "User not found"
*/ */
export const GET = auth(async function GET(req) { export const GET = auth(async function GET(req) {
if (!req.auth) if (!req.auth)
@ -106,76 +106,73 @@ export const GET = auth(async function GET(req) {
/** /**
* @swagger * @swagger
* /api/user/me: * /api/user/me:
* patch: * patch:
* summary: Update the currently authenticated user's information * summary: Update the currently authenticated user's information
* description: Update the information of the currently authenticated user. * description: Update the information of the currently authenticated user.
* tags: * tags:
* - User * - User
* requestBody: * requestBody:
* required: true * required: true
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * type: object
* properties: * properties:
* name: * name:
* type: string * type: string
* description: Username of the user. * description: Username of the user.
* first_name: * first_name:
* type: string * type: string
* description: First name of the user. * description: First name of the user.
* last_name: * last_name:
* type: string * type: string
* description: Last name of the user. * description: Last name of the user.
* email: * email:
* type: string * type: string
* description: Email address of the user. * description: Email address of the user.
* image: * image:
* type: string * type: string
* description: URL of the user's profile image. * description: URL of the user's profile image.
* timezone: * timezone:
* type: string * type: string
* description: Timezone of the user. * description: Timezone of the user.
* responses: * responses:
* 200: * 200:
* description: User information updated successfully. * description: User information updated successfully.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * type: object
* properties: * properties:
* success: * success:
* type: boolean * type: boolean
* default: true * default: true
* user: * user:
* $ref: '#/components/schemas/User' * $ref: "#/components/schemas/User"
* 401: * 401:
* description: User is not authenticated. * description: User is not authenticated.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'Not authenticated' * message: "Not authenticated"
* 404: * 404:
* description: User not found. * description: User not found.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ErrorResponse"
* example: * example:
* success: false * success: false
* message: 'User not found' * message: "User not found"
* 400: * 400:
* description: Bad request due to invalid input data. * description: Invalid request data.
* content: * content:
* application/json: * application/json:
* schema: * schema:
* $ref: '#/components/schemas/ErrorResponse' * $ref: "#/components/schemas/ZodErrorResponse"
* example:
* success: false
* message: 'Invalid input data'
*/ */
export const PATCH = auth(async function PATCH(req) { export const PATCH = auth(async function PATCH(req) {
if (!req.auth) if (!req.auth)