const { PrismaClient } = require('@prisma/client'); const prisma = new PrismaClient(); async function testQuery() { const clientId = 'cmm48jpy60000qf5n7htsblly'; // Dupont Jeqn console.log('\n=== TEST PRISMA QUERY ==='); console.log('Recherche des patients pour clientId:', clientId); const patients = await prisma.patient.findMany({ where: { clientId: clientId }, include: { ordonnances: { include: { fichiers: true } } }, orderBy: { dateCreation: 'desc' } }); console.log('Nombre de patients trouvés:', patients.length); patients.forEach((p, index) => { console.log(`\nPatient ${index + 1}:`); console.log(` ID: ${p.id}`); console.log(` clientId: ${p.clientId}`); console.log(` OD Sphere: ${p.odSphere}, OD Cylindre: ${p.odCylindre}`); console.log(` OG Sphere: ${p.ogSphere}, OG Cylindre: ${p.ogCylindre}`); }); await prisma.$disconnect(); } testQuery().catch(console.error);