Add email field and add it to register logic
This commit is contained in:
@ -27,6 +27,19 @@ class UserRepository {
|
||||
throw new Error(`Failed to get user by username: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async getByEmail(email: string): Promise<User | null> {
|
||||
try {
|
||||
return await prisma.user.findUnique({
|
||||
where: {
|
||||
email
|
||||
}
|
||||
})
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to get user by email: ${error.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new UserRepository()
|
||||
|
Reference in New Issue
Block a user