-
-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Milestone
Description
model Checklist {
id String @id @default(cuid())
name String? @default("Checklist")
creator User @relation(fields: [userId], references: [id])
activities Activity[]
userId String
@@allow('create,read', true)
@@allow('update,delete', auth() == creator)
}
model Activity {
id String @id @default(cuid())
name String
answers Answer[]
checklist Checklist @relation(fields: [checklistId], references: [id], onDelete: Cascade)
checklistId String
@@allow('create,read', true)
@@allow('update,delete', auth() == checklist.creator)
}
model Answer {
id String @id @default(cuid())
notes String @default("")
activity Activity @relation(fields: [activityId], references: [id], onDelete: Cascade)
activityId String
user User @relation(fields: [userId], references: [id])
userId String
@@allow('create', true)
@@allow('read', auth() == user || auth() == activity.checklist.creator)
@@allow('read', user == activity.checklist.creator)
@@allow('update,delete', auth() == user)
}The @@allow('read', user == activity.checklist.creator) line will cause the compiler error
error TS2304: Cannot find name 'activity'.
87 id:((activity?.checklist ?? null)?.creator ?? null).id
~~~~~~~~However change it @@allow('read', activity.checklist.creator == user) works
Metadata
Metadata
Assignees
Labels
No labels