12 lines
337 B
TypeScript
12 lines
337 B
TypeScript
import { eq, or } from 'drizzle-orm'
|
|
import { db, table } from '~/db'
|
|
|
|
export async function checkMerchantExists(email: string, phone: string) {
|
|
const existingMerchant = await db.$count(table.merchants, or(
|
|
eq(table.merchants.contactEmail, email),
|
|
eq(table.merchants.contactPhone, phone),
|
|
))
|
|
|
|
return existingMerchant > 0
|
|
}
|