fix: login was KO by profile

This commit is contained in:
Julien Froidefond
2025-08-25 10:48:13 +02:00
parent 9a818b7205
commit d575596c71
3 changed files with 97 additions and 25 deletions

View File

@@ -101,6 +101,41 @@ export class UserService {
/**
* Récupère un utilisateur par son UUID
*/
/**
* Trouve un utilisateur par son profil (firstName, lastName)
*/
async findUserByProfile(profile: UserProfile): Promise<{
uuid: string;
teamId: string;
} | null> {
const pool = getPool();
const client = await pool.connect();
try {
const query = `
SELECT uuid_id, team_id
FROM users
WHERE first_name = $1 AND last_name = $2
`;
const result = await client.query(query, [
profile.firstName,
profile.lastName,
]);
if (result.rows.length === 0) {
return null;
}
return {
uuid: result.rows[0].uuid_id,
teamId: result.rows[0].team_id,
};
} finally {
client.release();
}
}
async getUserByUuid(userUuid: string): Promise<UserProfile | null> {
const pool = getPool();
const client = await pool.connect();