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