refactor: migrate authentication to NextAuth and clean up related services

This commit is contained in:
Julien Froidefond
2025-10-12 15:45:09 +02:00
parent 117ac243f5
commit 7d12a66c12
25 changed files with 558 additions and 353 deletions

View File

@@ -1,11 +1,24 @@
import { NextRequest, NextResponse } from "next/server";
import { AuthService } from "@/services/auth-service";
import { auth } from "@/auth";
import { evaluationService } from "@/services/evaluation-service";
export async function PUT(request: NextRequest) {
try {
// Récupérer l'utilisateur depuis le cookie (maintenant un UUID)
const { userProfile } = await AuthService.requireAuthenticatedUser();
// Récupérer l'utilisateur depuis la session NextAuth
const session = await auth();
if (!session?.user) {
return NextResponse.json(
{ error: "Non authentifié" },
{ status: 401 }
);
}
const userProfile = {
firstName: session.user.firstName,
lastName: session.user.lastName,
teamId: session.user.teamId,
};
const body = await request.json();
const { category, skillId, level, canMentor, wantsToLearn, action } = body;