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

@@ -1,5 +1,6 @@
import { auth } from "@/lib/auth";
import { userService } from "@/services/users/user.service";
import { challengeService } from "@/services/challenges/challenge.service";
import Navigation from "./Navigation";
interface UserData {
@@ -17,6 +18,7 @@ export default async function NavigationWrapper() {
let userData: UserData | null = null;
const isAdmin = session?.user?.role === "ADMIN";
let activeChallengesCount = 0;
if (session?.user?.id) {
const user = await userService.getUserById(session.user.id, {
@@ -32,7 +34,17 @@ export default async function NavigationWrapper() {
if (user) {
userData = user;
}
// Récupérer le nombre de défis actifs
activeChallengesCount =
await challengeService.getActiveChallengesCount(session.user.id);
}
return <Navigation initialUserData={userData} initialIsAdmin={isAdmin} />;
return (
<Navigation
initialUserData={userData}
initialIsAdmin={isAdmin}
initialActiveChallengesCount={activeChallengesCount}
/>
);
}