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

async function checkSubsections() {
  const bookId = 5;
  
  // 查找前10个已完成内容的小节
  const subsections = await prisma.bookChapter.findMany({
    where: {
      bookId,
      level: 3,
      contentStatus: 'completed'
    },
    select: {
      id: true,
      title: true,
      wordCount: true,
      parentId: true,
    },
    orderBy: { id: 'asc' },
    take: 10
  });
  
  console.log('\n📖 Book 5 已完成内容的小节（前10个）：\n');
  
  subsections.forEach((sub, index) => {
    console.log(`${index + 1}. ID: ${sub.id} - ${sub.title} (${sub.wordCount}字)`);
  });
  
  console.log(`\n💡 访问示例: http://localhost:5173/#/pages/book-generator/chapter-detail?bookId=5&chapter=${subsections[0].id}`);
  
  await prisma.$disconnect();
}

checkSubsections().catch(console.error);
