generated from fahricansecer/boilerplate-be
This commit is contained in:
25
test-recent-master.ts
Normal file
25
test-recent-master.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const latestMaster = await prisma.masterContent.findFirst({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
include: { contents: true }
|
||||
});
|
||||
|
||||
if (!latestMaster) {
|
||||
console.log("No master content found.");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Latest Master ID: ${latestMaster.id}`);
|
||||
console.log(`Number of contents: ${latestMaster.contents.length}`);
|
||||
for (const c of latestMaster.contents) {
|
||||
console.log(` - ID: ${c.id}, Type: ${c.type}, Title: ${c.title}`);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user