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,6 +1,5 @@
import { getPool } from "./database";
import { userService } from "./user-service";
import { AuthService } from "./auth-service";
import {
UserEvaluation,
UserProfile,
@@ -121,8 +120,12 @@ export class EvaluationService {
try {
await client.query("BEGIN");
// 1. Upsert user avec UUID
const userUuid = await AuthService.getUserUuidFromCookie();
// 1. Récupérer le userUuid depuis le profile de l'évaluation
const existingUser = await userService.findUserByProfile(evaluation.profile);
if (!existingUser) {
throw new Error("Utilisateur non trouvé");
}
const userUuid = existingUser.uuid;
// 2. Upsert user_evaluation avec user_uuid
const userEvalQuery = `
@@ -624,7 +627,12 @@ export class EvaluationService {
try {
await client.query("BEGIN");
const userUuid = await AuthService.getUserUuidFromCookie();
// Récupérer le userUuid depuis le profile
const existingUser = await userService.findUserByProfile(profile);
if (!existingUser) {
throw new Error("Utilisateur non trouvé");
}
const userUuid = existingUser.uuid;
// Supprimer directement la skill evaluation
const deleteQuery = `