added tons of features
This commit is contained in:
21
actions/auth/common.ts
Normal file
21
actions/auth/common.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
'use server'
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user