reset-book.ts 850 B

1234567891011121314151617181920212223
  1. const { prisma } = require('../src/models');
  2. (async () => {
  3. const bookId = 53;
  4. // Reset chapters to content_completed, clear audioUrl
  5. const result = await prisma.bookChapter.updateMany({
  6. where: { bookId, content: { not: null } },
  7. data: { genStage: 'content_completed', audioUrl: '', audioDuration: 0, lrcLyrics: '' },
  8. });
  9. console.log(`Reset ${result.count} chapters to content_completed`);
  10. // Delete failed TtsTasks for this book
  11. const del = await prisma.ttsTask.deleteMany({
  12. where: { bookId, status: 'failed' }
  13. });
  14. console.log(`Deleted ${del.count} failed TtsTasks`);
  15. // Update book genStage
  16. await prisma.book.update({ where: { id: bookId }, data: { genStage: 'content_completed' } });
  17. console.log('Book #53 reset to content_completed. Ready for TTS retry test.');
  18. await prisma.$disconnect();
  19. })();