added 2FA

This commit is contained in:
2024-04-26 22:16:21 +03:00
parent 53cadc289a
commit f17a002ac6
38 changed files with 1036 additions and 414 deletions

View File

@@ -0,0 +1,33 @@
'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
}
}