Initial commit
This commit is contained in:
37
test-prisma-query.js
Normal file
37
test-prisma-query.js
Normal file
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user