fix(api): update paths in Swagger documentation to include '/api' prefix
This commit is contained in:
parent
eef17c5360
commit
5e9f8b59a4
5 changed files with 44 additions and 11 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue