Skip to content

[BUG] @@auth doesn't work if a User model is defined #1694

@onimitch

Description

@onimitch

Description and expected behavior
If you specify @@auth on a model but also have a User model defined, Zenstack uses the User model for the AuthUser type.

model AuthUser {
    @@auth
    id String @id
}

model User {
    id String @id @default(cuid())
}

With the models above, enhance expects a type matching User despite me marking AuthUser as @@auth.

Currently my workaround is to not use @@auth, and name my AuthUser model User, but that's forced me to name my "real" User model to something else, which I don't want to do.

model User {
    id String @id
}

model RealUser {
    id String @id @default(cuid())
}

Expected behaviour

I can use @@auth on a Model and still define a User model myself.

Environment (please complete the following information)

  • ZenStack version: 2.5.1
  • Prisma version: 5.18.0
  • Database type: Postgresql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions