diff options
Diffstat (limited to 'lib/users/repository.ts')
| -rw-r--r-- | lib/users/repository.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/users/repository.ts b/lib/users/repository.ts index 78d1668b..3a404bde 100644 --- a/lib/users/repository.ts +++ b/lib/users/repository.ts @@ -111,8 +111,6 @@ export const getOtpByEmailAndCode = async ( code: string ): Promise<Otp | null> => { - console.log(email, code, "db") - const [otp] = await db .select() .from(otps) @@ -123,6 +121,20 @@ export const getOtpByEmailAndCode = async ( return otp ?? null; }; +export const getOtpByEmail = async ( + email: string, +): Promise<User | null> => { + + const [user] = await db + .select() + .from(users) + .where( + eq(users.email, email) + ); + + return user ?? null; +}; + export async function findAllRoles(): Promise<Role[]> { return db.select().from(roles).where(eq(roles.domain ,'evcp')).orderBy(asc(roles.name)); }
\ No newline at end of file |
