initial commit

This commit is contained in:
Harivansh Rathi 2024-11-24 20:56:03 -05:00
commit ef9ccf22d3
133 changed files with 20802 additions and 0 deletions

View file

@ -0,0 +1,25 @@
import { db } from '@/lib/db'
// token functionality
export const getPasswordResetTokenByToken = async (token: string) => {
try {
const passwordResetToken = await db.passwordResetToken.findUnique({
where: { token }
})
return passwordResetToken
} catch {
return null
}
}
// Token Email functionality (match emails)
export const getPasswordResetTokenByEmail = async (email: string) => {
try {
const passwordResetToken = await db.passwordResetToken.findFirst({
where: { email }
})
return passwordResetToken
} catch {
return null
}
}

19
data/user.ts Normal file
View file

@ -0,0 +1,19 @@
import { db } from '@/lib/db'
export const getUserByEmail = async (email: string) => {
try {
const user = await db.user.findUnique({ where: { email } })
return user
} catch {
return null
}
}
export const getUserById = async (id: string) => {
try {
const user = await db.user.findUnique({ where: { id } })
return user
} catch {
return null
}
}

View file

@ -0,0 +1,27 @@
import { db } from '@/lib/db'
export const getVerificationTokenByToken = async (token: string) => {
// Get Verification Token
try {
const verificationToken = await db.verificationToken.findUnique({
where: { token }
})
return verificationToken
} catch {
return null
}
}
export const getVerificationTokenByEmail = async (email: string) => {
// Get Email Verification
try {
const verificationToken = await db.verificationToken.findFirst({
where: { email }
})
return verificationToken
} catch {
return null
}
}