diff --git a/app/api/admin/events/[id]/route.ts b/app/api/admin/events/[id]/route.ts
index b3fb9fb..881c8e5 100644
--- a/app/api/admin/events/[id]/route.ts
+++ b/app/api/admin/events/[id]/route.ts
@@ -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 },
diff --git a/app/api/admin/events/route.ts b/app/api/admin/events/route.ts
index d75ae4d..e804f1e 100644
--- a/app/api/admin/events/route.ts
+++ b/app/api/admin/events/route.ts
@@ -22,6 +22,9 @@ export async function GET() {
description: true,
type: true,
status: true,
+ room: true,
+ time: true,
+ maxPlaces: true,
createdAt: true,
updatedAt: true,
_count: {
@@ -40,6 +43,9 @@ export async function GET() {
description: event.description,
type: event.type,
status: event.status,
+ room: event.room,
+ time: event.time,
+ maxPlaces: event.maxPlaces,
createdAt: event.createdAt.toISOString(),
updatedAt: event.updatedAt.toISOString(),
registrationsCount: event._count.registrations,
@@ -64,7 +70,7 @@ export async function POST(request: Request) {
}
const body = await request.json();
- const { date, name, description, type, status } = body;
+ const { date, name, description, type, status, room, time, maxPlaces } = body;
if (!date || !name || !description || !type || !status) {
return NextResponse.json(
@@ -95,6 +101,9 @@ export async function POST(request: Request) {
description,
type: type as EventType,
status: status as EventStatus,
+ room: room || null,
+ time: time || null,
+ maxPlaces: maxPlaces ? parseInt(maxPlaces) : null,
},
});
diff --git a/components/EventManagement.tsx b/components/EventManagement.tsx
index 8e34b3d..3a5fd78 100644
--- a/components/EventManagement.tsx
+++ b/components/EventManagement.tsx
@@ -7,8 +7,11 @@ interface Event {
date: string;
name: string;
description: string;
- type: "SUMMIT" | "LAUNCH" | "FESTIVAL" | "COMPETITION";
+ type: "SUMMIT" | "LAUNCH" | "FESTIVAL" | "COMPETITION" | "CODE_KATA";
status: "UPCOMING" | "LIVE" | "PAST";
+ room?: string | null;
+ time?: string | null;
+ maxPlaces?: number | null;
createdAt: string;
updatedAt: string;
registrationsCount?: number;
@@ -18,8 +21,11 @@ interface EventFormData {
date: string;
name: string;
description: string;
- type: "SUMMIT" | "LAUNCH" | "FESTIVAL" | "COMPETITION";
+ type: "SUMMIT" | "LAUNCH" | "FESTIVAL" | "COMPETITION" | "CODE_KATA";
status: "UPCOMING" | "LIVE" | "PAST";
+ room?: string;
+ time?: string;
+ maxPlaces?: number;
}
const eventTypes: Event["type"][] = [
@@ -27,6 +33,7 @@ const eventTypes: Event["type"][] = [
"LAUNCH",
"FESTIVAL",
"COMPETITION",
+ "CODE_KATA",
];
const eventStatuses: Event["status"][] = ["UPCOMING", "LIVE", "PAST"];
@@ -40,6 +47,8 @@ const getEventTypeLabel = (type: Event["type"]) => {
return "Festival";
case "COMPETITION":
return "Compétition";
+ case "CODE_KATA":
+ return "Code Kata";
default:
return type;
}
@@ -70,6 +79,9 @@ export default function EventManagement() {
description: "",
type: "SUMMIT",
status: "UPCOMING",
+ room: "",
+ time: "",
+ maxPlaces: undefined,
});
useEffect(() => {
@@ -99,6 +111,9 @@ export default function EventManagement() {
description: "",
type: "SUMMIT",
status: "UPCOMING",
+ room: "",
+ time: "",
+ maxPlaces: undefined,
});
};
@@ -111,6 +126,9 @@ export default function EventManagement() {
description: event.description,
type: event.type,
status: event.status,
+ room: event.room || "",
+ time: event.time || "",
+ maxPlaces: event.maxPlaces || undefined,
});
};
@@ -146,6 +164,9 @@ export default function EventManagement() {
description: "",
type: "SUMMIT",
status: "UPCOMING",
+ room: "",
+ time: "",
+ maxPlaces: undefined,
});
} else {
const error = await response?.json();
@@ -190,6 +211,9 @@ export default function EventManagement() {
description: "",
type: "SUMMIT",
status: "UPCOMING",
+ room: "",
+ time: "",
+ maxPlaces: undefined,
});
};
@@ -298,6 +322,55 @@ export default function EventManagement() {
+