Add dotenv package for environment variable management and update pnpm-lock.yaml. Adjust layout in RegisterPage and LoginPage components for improved responsiveness. Enhance AdminPanel with ChallengeManagement section and update navigation links for challenges. Refactor Prisma schema to include Challenge model and related enums.
Some checks failed
Deploy with Docker Compose / deploy (push) Failing after 3m2s

This commit is contained in:
Julien Froidefond
2025-12-15 15:16:54 +01:00
parent 9518eef3d4
commit f093977b34
34 changed files with 11414 additions and 9081 deletions

39
app/api/users/route.ts Normal file
View File

@@ -0,0 +1,39 @@
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
import { userService } from "@/services/users/user.service";
export async function GET() {
try {
const session = await auth();
if (!session?.user?.id) {
return NextResponse.json({ error: "Vous devez être connecté" }, { status: 401 });
}
// Récupérer tous les utilisateurs (pour sélectionner qui défier)
const users = await userService.getAllUsers({
orderBy: {
username: "asc",
},
select: {
id: true,
username: true,
avatar: true,
score: true,
level: true,
},
});
// Filtrer l'utilisateur actuel
const otherUsers = users.filter((user) => user.id !== session.user.id);
return NextResponse.json(otherUsers);
} catch (error) {
console.error("Error fetching users:", error);
return NextResponse.json(
{ error: "Erreur lors de la récupération des utilisateurs" },
{ status: 500 }
);
}
}