Enhance event model and management: Add new fields for room, time, and maxPlaces to the Event model in Prisma schema. Update API routes and UI components to support these fields, improving event details and user interaction in event management and registration processes.
This commit is contained in:
@@ -16,7 +16,7 @@ export async function PUT(
|
||||
|
||||
const { id } = await params;
|
||||
const body = await request.json();
|
||||
const { date, name, description, type, status } = body;
|
||||
const { date, name, description, type, status, room, time, maxPlaces } = body;
|
||||
|
||||
// Vérifier que l'événement existe
|
||||
const existingEvent = await prisma.event.findUnique({
|
||||
@@ -36,6 +36,9 @@ export async function PUT(
|
||||
description?: string;
|
||||
type?: EventType;
|
||||
status?: EventStatus;
|
||||
room?: string | null;
|
||||
time?: string | null;
|
||||
maxPlaces?: number | null;
|
||||
} = {};
|
||||
|
||||
if (date !== undefined) updateData.date = date;
|
||||
@@ -59,6 +62,9 @@ export async function PUT(
|
||||
}
|
||||
updateData.status = status as EventStatus;
|
||||
}
|
||||
if (room !== undefined) updateData.room = room || null;
|
||||
if (time !== undefined) updateData.time = time || null;
|
||||
if (maxPlaces !== undefined) updateData.maxPlaces = maxPlaces ? parseInt(maxPlaces) : null;
|
||||
|
||||
const event = await prisma.event.update({
|
||||
where: { id },
|
||||
|
||||
Reference in New Issue
Block a user