18 lines
369 B
TypeScript
18 lines
369 B
TypeScript
import {db} from '@/lib/db/prisma/client'
|
|
import {redisClient} from '@/lib/db/redis/client'
|
|
import {toInt} from '@/lib/utils'
|
|
|
|
export const getAccountByUserId = async (userId: unknown) => {
|
|
userId = toInt(userId)
|
|
if (!userId) return null
|
|
|
|
try {
|
|
return await db.account.findFirst({
|
|
where: {userId}
|
|
})
|
|
} catch (error) {
|
|
console.log(error)
|
|
return null
|
|
}
|
|
}
|