const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

async function main() {
  const users = await prisma.user.findMany({
    include: { tenant: true },
  });

  console.log('All users:');
  users.forEach(u => {
    const tenantName = u.tenant ? u.tenant.name : 'N/A';
    const tenantCode = u.tenant ? u.tenant.code : 'N/A';
    console.log(`  Tenant: ${tenantName} (${tenantCode}), User: ${u.username}, ID: ${u.id}`);
  });
}

main()
  .then(() => prisma.$disconnect())
  .catch(e => {
    console.error(e);
    prisma.$disconnect();
  });
