refactor: migrate authentication to NextAuth and clean up related services
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user