| 12345678910111213141516171819 |
- const { PrismaClient } = require('@prisma/client');
- const prisma = new PrismaClient();
- async function checkBooks() {
- const books = await prisma.book.findMany({
- orderBy: { id: 'desc' },
- take: 3,
- include: { _count: { select: { chapters: true } } }
- });
- console.log('最新3本书:');
- books.forEach(b => {
- console.log(` id=${b.id}, title=${b.title}, status=${b.status}, chapters=${b._count.chapters}`);
- });
- await prisma.$disconnect();
- }
- checkBooks();
|