Skip to content

[ZModel] Insufficient type checking for "in" operator  #1236

@ymc9

Description

@ymc9
model User {
  id Int @id @default(autoincrement())
  email String @unique
  name String?
  posts Post[]
  teamMemberships TeamMembership[]

  @@allow('all', true)
}

model TeamMembership {
  id Int @id @default(autoincrement())
  teamId Int
  user User @relation(fields: [userId], references: [id])
  userId Int

  @@allow('all', true)
}

model Post {
  id Int @id @default(autoincrement())
  title String

  owner User? @relation(fields: [ownerId], references: [id])
  ownerId Int?
  teamId Int

  @@allow('all', true)
  @@deny('all', teamId in auth().teamMemberships)
}

Inside the @@deny rule, the "in" expression should result in a type-checker error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions