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

async function verifyUpdate() {
  console.log('\n 验证更新结果：\n');
  
  // 随机检查5个小节
  const samples = await prisma.bookChapter.findMany({
    where: {
      level: 3
    },
    select: {
      id: true,
      title: true,
      content: true,
      contentStatus: true,
      wordCount: true,
    },
    take: 5
  });
  
  console.log('随机抽查5个小节：\n');
  samples.forEach((sub, index) => {
    console.log(`${index + 1}. ${sub.title}`);
    console.log(`   内容: "${sub.content}"`);
    console.log(`   状态: ${sub.contentStatus}`);
    console.log(`   字数: ${sub.wordCount}\n`);
  });
  
  // 统计
  const stats = await prisma.bookChapter.groupBy({
    by: ['contentStatus'],
    where: { level: 3 },
    _count: true,
  });
  
  console.log('📈 内容状态统计：');
  stats.forEach(s => {
    console.log(`   ${s.contentStatus}: ${s._count} 个`);
  });
  
  await prisma.$disconnect();
}

verifyUpdate().catch(console.error);
