import { PrismaClient } from '@prisma/client';
import { PrismaPg } from '@prisma/adapter-pg';
import { Pool } from 'pg';
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const prisma = new PrismaClient({ adapter: new PrismaPg(pool) });
try {
  const dealers = await prisma.dealer.findMany({
    where: { OR: [{ subdomain: { contains: 'bestsynoil' } }, { customDomain: { contains: 'bestsynoil' } }] },
    select: {
      id: true, subdomain: true, domain: true, domainPrefix: true,
      customDomain: true, customDomainStatus: true, status: true,
      createdAt: true,
      user: { select: { email: true } },
      _count: { select: { gscJobs: true } },
    },
  });
  console.log('Found ' + dealers.length + ' matching dealers:');
  for (const d of dealers) {
    console.log(JSON.stringify(d, null, 2));
  }
} finally { await prisma.$disconnect(); await pool.end(); }
