| 1234567891011121314151617181920212223 |
- const { PrismaClient } = require('@prisma/client');
- const p = new PrismaClient();
- (async () => {
- // book 43 chapters
- const chapters = await p.bookChapter.findMany({
- where: { bookId: 43 },
- select: { id: true, number: true, title: true, level: true, genStage: true, parentId: true },
- });
- console.log('=== book 43 chapters ===');
- console.log(JSON.stringify(chapters, null, 2));
- // 全部 failed 状态的书
- const failed = await p.book.findMany({
- where: { OR: [{ genStage: 'failed' }, { failedStage: { not: null } }] },
- select: { id: true, title: true, userId: true, genStage: true, failedStage: true, errorMsg: true, progress: true, totalChapters: true, updatedAt: true },
- orderBy: { updatedAt: 'desc' },
- take: 20,
- });
- console.log('\n=== failed books (latest 20) ===');
- failed.forEach(bk => console.log(JSON.stringify(bk)));
- await p.$disconnect();
- })();
|