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.
model User {
id Int @id @default(autoincrement())
// posts Post[]. no need to specify it in Zmodel, ZenStack will generate it in the schema.prisma file.
}
model Post {
id Int @id @default(autoincrement())
author User @relation(fields: [authorId], references: [id])
authorId Int
}
Need naming convention rule to generate the inversed relation. Also, need a way to distinguish between one-to-one and one-to-many.
Support the below schema:
Need naming convention rule to generate the inversed relation. Also, need a way to distinguish between one-to-one and one-to-many.
Take a reference of how EF handles it: https://learn.microsoft.com/en-us/ef/core/modeling/relationships/one-to-one#one-to-one-without-navigation-to-dependent