const { prisma } = require('../src/models');
(async () => {
  const b = await prisma.book.findUnique({ where: { id: 60 }, select: { genStage: true, progress: true, id: true, title: true } });
  console.log('Book60:', JSON.stringify(b));
  
  const ch = await prisma.bookChapter.findMany({ where: { bookId: 60 }, select: { id: true, genStage: true, content: true } });
  for (const c of ch) console.log(`  ch${c.id}: ${c.genStage} content=${(c.content||'').length}`);
  
  const total = await prisma.aiCallLog.count();
  const byType = await prisma.aiCallLog.groupBy({ by: ['callType'], _count: { id: true } });
  console.log('\nAiCallLog:', total);
  for (const t of byType) console.log(`  ${t.callType}: ${t._count.id}`);
  
  await prisma.$disconnect();
})();
