check-prod2.js 900 B

1234567891011121314151617181920212223
  1. const { PrismaClient } = require('@prisma/client');
  2. const p = new PrismaClient();
  3. (async () => {
  4. // book 43 chapters
  5. const chapters = await p.bookChapter.findMany({
  6. where: { bookId: 43 },
  7. select: { id: true, number: true, title: true, level: true, genStage: true, parentId: true },
  8. });
  9. console.log('=== book 43 chapters ===');
  10. console.log(JSON.stringify(chapters, null, 2));
  11. // 全部 failed 状态的书
  12. const failed = await p.book.findMany({
  13. where: { OR: [{ genStage: 'failed' }, { failedStage: { not: null } }] },
  14. select: { id: true, title: true, userId: true, genStage: true, failedStage: true, errorMsg: true, progress: true, totalChapters: true, updatedAt: true },
  15. orderBy: { updatedAt: 'desc' },
  16. take: 20,
  17. });
  18. console.log('\n=== failed books (latest 20) ===');
  19. failed.forEach(bk => console.log(JSON.stringify(bk)));
  20. await p.$disconnect();
  21. })();