Git Product home page Git Product logo

Comments (3)

israelins85 avatar israelins85 commented on July 24, 2024 1
abstract model AbsModelPadrao {
  id              String   @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid

  dtHrCriacao     DateTime @default(now()) @db.Timestamptz
  dtHrAtualizacao DateTime @default(now()) @updatedAt() @db.Timestamptz
}

model Usuario extends AbsModelPadrao {
  nome              String
  sobrenome         String?
  login             String                @unique
  senha             String                @password @omit
  codIdioma         String                @default("en_US")
  dtFimTeste        DateTime              @db.Date @default(dbgenerated("(CURRENT_DATE + '30 days'::INTERVAL)")) @deny("update", true)

  pin               String?               @omit
  status            UsuarioStatus         @default(NaoAtivado)

  // users can change its own data
  @@allow("all", auth() != null && auth().id == id)

  @@auth()

  alunos            Aluno[]
}

abstract model AbsModelDadosDoUsuario {
  id              String   @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid
  usuarioId       String   @db.Uuid @default(auth().id)

  dtHrCriacao     DateTime @default(now()) @db.Timestamptz
  dtHrAtualizacao DateTime @default(now()) @updatedAt() @db.Timestamptz

  // relations
  usuario         Usuario  @relation(fields: [usuarioId], references: [id], onDelete: Cascade)

  // allow acess to myself
  @@allow("all", auth() != null && auth().id == usuarioId)

  @@index([usuarioId])
}

model Aluno extends AbsModelDadosDoUsuario {
  nome          String
  sobrenome     String?
  celular       String?
  email         String?
  observacoes   String?
  saldoDeAulas  Int                @default(0)
  dtNascimento  DateTime?          @db.Date
  peso          Float?
  altura        Float?
  removido      Boolean            @default(false)

  @@prisma.passthrough("@@index([nome(ops: raw(\"gin_trgm_ops\"))], type: Gin, name: \"Aluno_nome_idx\")")
}

from zenstack.

ymc9 avatar ymc9 commented on July 24, 2024

Hi @israelins85 , thanks for reporting this. Could you share a ZModel snippet that can be used to reproduce the problem?

from zenstack.

ymc9 avatar ymc9 commented on July 24, 2024

Hi @israelins85 , I had a try but couldn't reproduce this issue with v2.2.3. I've shared a project here: https://github.com/ymc9/issue-1519

Could you check what differences it may have with your project? Thanks!

from zenstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.