fix: login was KO by profile
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user