33 lines
854 B
TypeScript
33 lines
854 B
TypeScript
'use server'
|
|
|
|
import db from '@/lib/db'
|
|
import journal from '@/actions/logger'
|
|
|
|
export const createTwoFactoComfirmation = async (userId: string) => {
|
|
try {
|
|
return await db.twoFactorComfirmation.create({ data: { userId } })
|
|
} catch (err) {
|
|
journal.error({ createTwoFactoComfirmation: err, userId })
|
|
return null
|
|
}
|
|
}
|
|
|
|
export const getTwoFactorConfirmationByUserId = async (userId: string) => {
|
|
try {
|
|
return await db.twoFactorComfirmation.findUnique({
|
|
where: { userId },
|
|
})
|
|
} catch (err) {
|
|
journal.error({ getTwoFactorConfirmationByUserId: err, userId })
|
|
return null
|
|
}
|
|
}
|
|
|
|
export const deleteTwoFactoComfirmation = async (id: string) => {
|
|
try {
|
|
return await db.twoFactorComfirmation.delete({ where: { id } })
|
|
} catch (err) {
|
|
journal.error({ deleteTwoFactoComfirmation: err, id })
|
|
return null
|
|
}
|
|
} |