import { PrismaClient } from '@prisma/client'; const prisma = new PrismaClient(); async function main() { const total = await prisma.group.count({ where: { claimStatus: 'PENDING_CLAIM' } }); const perTenant = await prisma.tenant.findMany({ where: { groups: { some: { claimStatus: 'PENDING_CLAIM' } } }, select: { id: true, name: true, slug: true, _count: { select: { groups: { where: { claimStatus: 'PENDING_CLAIM' } } } }, }, }); const sample = await prisma.group.findMany({ where: { claimStatus: 'PENDING_CLAIM' }, take: 3, select: { id: true, name: true, platform: true, platformId: true, createdAt: true }, }); console.log('TOTAL PENDING_CLAIM:', total); console.log('PER TENANT:', JSON.stringify(perTenant, null, 2)); console.log('SAMPLE:', JSON.stringify(sample, null, 2)); } main() .catch((e) => { console.error(e); process.exit(1); }) .finally(() => prisma.$disconnect());