23 lines
608 B
TypeScript
23 lines
608 B
TypeScript
'use server'
|
|
|
|
// @ts-ignore
|
|
import {getUserWithAccount} from '@prisma/client/sql'
|
|
|
|
import {getAccountByUserId} from '@/data/accout'
|
|
import {getUserById} from '@/data/user'
|
|
import {db} from '@/lib/db/prisma/client'
|
|
|
|
export const exisingUser = async (id: string | number) => {
|
|
return await getUserById(id)
|
|
}
|
|
|
|
export const exisingUserAccount = async (userId: string | number) => {
|
|
return await getAccountByUserId(userId)
|
|
}
|
|
|
|
export const getUserAccountByUserId = async (userId: string | number) => {
|
|
const user = await db.$queryRawTyped(getUserWithAccount(userId))
|
|
|
|
return user.length > 0 ? user[0] : null
|
|
}
|