Add admin challenge management features: Implement functions for canceling and reactivating challenges, enhance error handling, and update the ChallengeManagement component to support these actions. Update API to retrieve all challenge statuses for admin and improve UI to display active challenges count.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m16s

This commit is contained in:
Julien Froidefond
2025-12-15 22:19:58 +01:00
parent 633245c1f1
commit bfaf30ee26
9 changed files with 390 additions and 53 deletions

View File

@@ -11,12 +11,8 @@ export async function GET() {
return NextResponse.json({ error: "Accès refusé" }, { status: 403 });
}
// Récupérer tous les défis (PENDING et ACCEPTED) pour l'admin
const allChallenges = await challengeService.getAllChallenges();
// Filtrer pour ne garder que PENDING et ACCEPTED
const challenges = allChallenges.filter(
(c) => c.status === "PENDING" || c.status === "ACCEPTED"
);
// Récupérer tous les défis pour l'admin (PENDING, ACCEPTED, CANCELLED, COMPLETED, REJECTED)
const challenges = await challengeService.getAllChallenges();
return NextResponse.json(challenges);
} catch (error) {