diff --git a/app/api/admin/events/[id]/registrations/route.ts b/app/api/admin/events/[id]/registrations/route.ts new file mode 100644 index 0000000..c150446 --- /dev/null +++ b/app/api/admin/events/[id]/registrations/route.ts @@ -0,0 +1,31 @@ +import { NextResponse } from "next/server"; +import { auth } from "@/lib/auth"; +import { eventRegistrationService } from "@/services/events/event-registration.service"; +import { Role } from "@/prisma/generated/prisma/client"; + +export async function GET( + request: Request, + { params }: { params: Promise<{ id: string }> } +) { + try { + const session = await auth(); + + if (!session?.user || session.user.role !== Role.ADMIN) { + return NextResponse.json({ error: "Accès refusé" }, { status: 403 }); + } + + const { id: eventId } = await params; + const registrations = await eventRegistrationService.getEventRegistrations( + eventId + ); + + return NextResponse.json(registrations); + } catch (error) { + console.error("Error fetching event registrations:", error); + return NextResponse.json( + { error: "Erreur lors de la récupération des inscrits" }, + { status: 500 } + ); + } +} + diff --git a/components/admin/ChallengeManagement.tsx b/components/admin/ChallengeManagement.tsx index d9717a4..4a2fb1b 100644 --- a/components/admin/ChallengeManagement.tsx +++ b/components/admin/ChallengeManagement.tsx @@ -9,7 +9,15 @@ import { adminCancelChallenge, reactivateChallenge, } from "@/actions/admin/challenges"; -import { Button, Card, Input, Textarea, Alert, Modal, CloseButton } from "@/components/ui"; +import { + Button, + Card, + Input, + Textarea, + Alert, + Modal, + CloseButton, +} from "@/components/ui"; import { Avatar } from "@/components/ui"; interface Challenge { @@ -441,115 +449,115 @@ export default function ChallengeManagement() { /> -
-

- {selectedChallenge.title} -

-

- {selectedChallenge.description} -

+
+

+ {selectedChallenge.title} +

+

+ {selectedChallenge.description} +

-
-
- - - {selectedChallenge.challenger.username} - -
- VS -
- - - {selectedChallenge.challenged.username} - -
+
+
+ + + {selectedChallenge.challenger.username} + +
+ VS +
+ + + {selectedChallenge.challenged.username} +
+
-
- -
- - -
-
- -
- -