Closed
Description
Description and expected behavior
Background:
I'm following this article: https://zenstack.dev/blog/soft-delete-real to implement soft-delete
Problem
if we get data directly from the model itself db.product.findMany()
, it does omit deleted
field. But, if we get the data thru include
e.g, db.category.findFirst({include: {products: true}})
, it doesn't omit the deleted
field.
expected behavior
my expectation was to also exclude the field when using relationships.
schema example (simplified):
model Product {
id String @id @default(cuid())
category Category @relation(fields: [categoryId], references: [id])
categoryId String
deleted Int @default(0) @omit
@@deny('read', deleted != 0)
}
model Category {
products Product[]
}
Environment (please complete the following information):
- ZenStack version: [1.8.1]
- Prisma version: [5.7.1]
- Database type: [SQLite]