Skip to content

Commit

Permalink
Merge pull request #675 from desci-labs/quick-patch
Browse files Browse the repository at this point in the history
Patch calls to. get user details in auth middleware
  • Loading branch information
shadrach-tayo authored Nov 26, 2024
2 parents 66d7c99 + 3e87708 commit 467a359
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions desci-repo/src/services/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ export async function getUserByOrcId(orcid: string): Promise<any | null> {
}

export async function getUserByEmail(email: string): Promise<any | null> {
logger.trace({ email: ` ${hideEmail(email)}` }, `user::getUserByEmail`);
const rows = await query('SELECT * FROM "User" WHERE lower(email) = $1', [email.toLowerCase()]);
logger.trace({ rowLength: rows?.length }, 'getUserByEmail query');
try {
logger.trace({ email: ` ${hideEmail(email)}` }, `user::getUserByEmail`);
const rows = await query('SELECT * FROM "User" WHERE lower(email) = $1', [email.toLowerCase()]);
logger.trace({ rowLength: rows?.length }, 'getUserByEmail query');

const user = rows?.[0];
const user = rows?.[0];

return user;
return user;
} catch (err) {
logger.error({ err }, 'getUserByEmail');
return null;
}
}

0 comments on commit 467a359

Please sign in to comment.