final-check.ts 1.0 KB

1234567891011121314151617181920212223242526
  1. const { prisma } = require('../src/models');
  2. (async () => {
  3. // TtsTask stats
  4. const total = await prisma.ttsTask.count();
  5. console.log(`TtsTask total: ${total}`);
  6. // Check for duplicates
  7. const dupCheck = await prisma.ttsTask.groupBy({
  8. by: ['chapterId'], _count: { id: true }, having: { id: { _count: { gt: 1 } } },
  9. });
  10. console.log(`Duplicates found: ${dupCheck.length}`);
  11. for (const d of dupCheck)
  12. console.log(` ⚠️ chapterId=${d.chapterId}: ${d._count.id} entries`);
  13. // Check status distribution
  14. const byStatus = await prisma.ttsTask.groupBy({ by: ['status'], _count: { id: true } });
  15. console.log('\nStatus distribution:');
  16. for (const s of byStatus) console.log(` ${s.status}: ${s._count.id}`);
  17. // All unique chapterIds
  18. const chapters = await prisma.ttsTask.findMany({ select: { chapterId: true, status: true, id: true }, orderBy: { id: 'asc' }, take: 10 });
  19. console.log('\nFirst 10 tasks:');
  20. for (const c of chapters) console.log(` #${c.id} chapterId=${c.chapterId} ${c.status}`);
  21. await prisma.$disconnect();
  22. })();