chore: refactor

This commit is contained in:
Catalin Pit
2024-01-30 12:54:48 +02:00
parent 1676f5bf6c
commit cc090adce0
8 changed files with 32 additions and 69 deletions

View File

@ -9,5 +9,8 @@ export const getUserByEmail = async ({ email }: GetUserByEmailOptions) => {
where: {
email: email.toLowerCase(),
},
include: {
VerificationToken: true,
},
});
};

View File

@ -20,6 +20,10 @@ export const sendConfirmationToken = async ({ email }: { email: string }) => {
throw new Error('User not found');
}
if (user.emailVerified) {
throw new Error('Email verified');
}
const createdToken = await prisma.verificationToken.create({
data: {
identifier: IDENTIFIER,