'use server' import { User } from '@prisma/client' import db from '@/lib/db' import journal from '@/actions/logger' export const getUserByEmail = async (email: string): Promise => { try { return await db.user.findUnique({ where: { email } }) } catch (err) { journal.error({ getUserByEmail: err, email }) return null } } export const getUserById = async (id: string): Promise => { try { return await db.user.findUnique({ where: { id } }) } catch (err) { journal.error({ getUserById: err, id }) return null } } export const updateUserEmailVerified = async (id: string, email: string) => { try { await db.user.update({ where: { id }, data: { email, emailVerified: new Date(), }, }) } catch (err) { journal.error({ updateUserEmailVerified: err, id, email }) return { error: 'db.error.update.user_data' } } }