zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 89 forks source link

[BUG] "Could not resolve reference to DataModelField" when using abstract field in future() #1695

Closed onimitch closed 2 weeks ago

onimitch commented 1 month ago

Description and expected behavior

abstract model SoftDelete {
    deleted Int @default(0) @omit
}

model MyModel extends SoftDelete {
    id      String @id @default(cuid())
    name    String

    @@deny('update', deleted != 0 && future().deleted != 0)
}

The above @deny rule errors: Could not resolve reference to DataModelField named 'deleted'.

Workaround for now: Place the deny rule in the abstract model.

Environment (please complete the following information)

ymc9 commented 1 month ago

Thanks for reporting this @onimitch . I'll confirm and make a fix soon.

ymc9 commented 2 weeks ago

Fixed in 2.6.0

onimitch commented 1 week ago

@ymc9 thanks!