model Content {
id String @id @default(cuid())
published Boolean @default(false)
contentType String
likes Like[]
@@delegate(contentType)
@@allow('all', true)
}
model Post extends Content {
title String
}
model Image extends Content {
url String
}
model Like {
id String @id @default(cuid())
content Content @relation(fields: [contentId], references: [id])
contentId String
@@allow('all', true)
}
db.content.findFirst({ include: { _count: { select: { likes: true } } } }));