fix(api): update paths in Swagger documentation to include '/api' prefix
All checks were successful
container-scan / Container Scan (pull_request) Successful in 2m54s
docker-build / docker (pull_request) Successful in 6m5s

This commit is contained in:
Dominik 2025-06-19 20:29:04 +02:00
parent eef17c5360
commit 5e9f8b59a4
Signed by: dominik
GPG key ID: 06A4003FC5049644
5 changed files with 44 additions and 11 deletions

View file

@ -19,7 +19,7 @@ import {
export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'get',
path: '/event/{eventID}/participant/{user}',
path: '/api/event/{eventID}/participant/{user}',
request: {
params: zod.object({
eventID: EventIdParamSchema,
@ -44,7 +44,7 @@ export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'delete',
path: '/event/{eventID}/participant/{user}',
path: '/api/event/{eventID}/participant/{user}',
request: {
params: zod.object({
eventID: EventIdParamSchema,
@ -69,7 +69,7 @@ export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'patch',
path: '/event/{eventID}/participant/{user}',
path: '/api/event/{eventID}/participant/{user}',
request: {
params: zod.object({
eventID: EventIdParamSchema,

View file

@ -16,7 +16,7 @@ import { EventIdParamSchema } from '@/app/api/validation';
export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'get',
path: '/event/{eventID}/participant',
path: '/api/event/{eventID}/participant',
request: {
params: zod.object({
eventID: EventIdParamSchema,
@ -40,7 +40,7 @@ export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'post',
path: '/event/{eventID}/participant',
path: '/api/event/{eventID}/participant',
request: {
params: zod.object({
eventID: EventIdParamSchema,

View file

@ -219,8 +219,32 @@ export const PATCH = auth(async (req, { params }) => {
{ status: 400 },
);
}
const { title, description, start_time, end_time, location, status } =
data.data;
const {
title,
description,
start_time,
end_time,
location,
status,
participants,
} = data.data;
if (participants !== undefined)
for (const participant of participants) {
await prisma.meetingParticipant.upsert({
where: {
meeting_id_user_id: {
user_id: participant,
meeting_id: eventID,
},
},
create: {
user_id: participant,
meeting_id: eventID,
},
update: {},
});
}
const updatedEvent = await prisma.meeting.update({
where: {
@ -233,6 +257,16 @@ export const PATCH = auth(async (req, { params }) => {
end_time,
location,
status,
participants:
participants !== undefined
? {
deleteMany: {
user_id: {
notIn: participants || [],
},
},
}
: {},
},
select: {
id: true,

View file

@ -15,7 +15,7 @@ import zod from 'zod/v4';
export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'get',
path: '/event/{eventID}',
path: '/api/event/{eventID}',
request: {
params: zod.object({
eventID: EventIdParamSchema,
@ -38,7 +38,7 @@ export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'delete',
path: '/event/{eventID}',
path: '/api/event/{eventID}',
request: {
params: zod.object({
eventID: EventIdParamSchema,
@ -62,7 +62,7 @@ export default function registerSwaggerPaths(registry: OpenAPIRegistry) {
registry.registerPath({
method: 'patch',
path: '/event/{eventID}',
path: '/api/event/{eventID}',
request: {
params: zod.object({
eventID: EventIdParamSchema,

View file

@ -113,7 +113,6 @@ export const createEventSchema = zod
// ----------------------------------------
export const updateEventSchema = zod
.object({
id: eventIdSchema,
title: eventTitleSchema.optional(),
description: eventDescriptionSchema.optional(),
start_time: eventStartTimeSchema.optional(),