const { prisma } = require('../src/models'); (async () => { // Find book with content to reset const chapters = await prisma.bookChapter.findMany({ where: { genStage: 'content_completed', content: { not: null }, title: { not: '' } }, select: { bookId: true, id: true, genStage: true, title: true }, take: 50, orderBy: { id: 'desc' } }); const bookIds = [...new Set(chapters.map(c => c.bookId))]; for (const bid of bookIds.slice(0,5)) { const book = await prisma.book.findUnique({ where: { id: bid }, select: { id: true, title: true, genStage: true, bookScale: true } }); const count = chapters.filter(c => c.bookId === bid).length; console.log(`#${bid}: "${book?.title?.substring(0,25)}" stage=${book?.genStage} scale=${book?.bookScale} chapters=${count}`); } console.log('\nPick one bookId to reset to content_completed state'); await prisma.$disconnect(); })();