generated from fahricansecer/boilerplate-be
This commit is contained in:
19
test-script2.ts
Normal file
19
test-script2.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
const prisma = new PrismaClient();
|
||||
async function main() {
|
||||
const masters = await prisma.masterContent.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 10,
|
||||
include: { contents: true }
|
||||
});
|
||||
|
||||
for (const master of masters) {
|
||||
console.log(`Master: ${master.id}, Topic: ${master.title}`);
|
||||
for (const c of master.contents) {
|
||||
console.log(` - ${c.type} -> title: ${c.title}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(async () => { await prisma.$disconnect(); });
|
||||
Reference in New Issue
Block a user