added mail service
This commit is contained in:
18
data/user.ts
Normal file
18
data/user.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { User } from '@prisma/client'
|
||||
import { db } from '@/lib/db'
|
||||
|
||||
export const getUserByEmail = async (email: string): Promise<User | null> => {
|
||||
try {
|
||||
return await db.user.findUnique({ where: { email } })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export const getUserById = async (id: string): Promise<User | null> => {
|
||||
try {
|
||||
return await db.user.findUnique({ where: { id } })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
17
data/verification-token.ts
Normal file
17
data/verification-token.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { db } from '@/lib/db'
|
||||
|
||||
export const getVerificationTokenByToken = async (token: string) => {
|
||||
try {
|
||||
return await db.verificationToken.findUnique({ where: { token } })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export const getVerificationTokenByEmail = async (email: string) => {
|
||||
try {
|
||||
return await db.verificationToken.findFirst({ where: { email } })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user