mirror of
https://github.com/harivansh-afk/Saas-Teamspace.git
synced 2026-04-17 00:04:54 +00:00
initial commit
This commit is contained in:
commit
ef9ccf22d3
133 changed files with 20802 additions and 0 deletions
25
data/password-reset-token.ts
Normal file
25
data/password-reset-token.ts
Normal 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
19
data/user.ts
Normal 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
|
||||
}
|
||||
}
|
||||
27
data/verification-token.ts
Normal file
27
data/verification-token.ts
Normal 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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue