Skip to content

Latest commit

 

History

History
117 lines (79 loc) · 4.06 KB

File metadata and controls

117 lines (79 loc) · 4.06 KB
//////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT MODIFY THIS FILE                                                                  //
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
// Source: showcase.zmodel · Generated: 2026-02-23                                          //
//////////////////////////////////////////////////////////////////////////////////////////////

Index / Models / Team

🗃️ Team Model

A team groups users within an organization for project collaboration.

Category: Identity · Since: 1.0 · Defined in: showcase.zmodel


Declaration · showcase.zmodel
model Team with Timestamps {
    id             String         @id @default(cuid())
    name           String         @length(1, 80)
    description    String?
    organization   Organization   @relation(fields: [organizationId], references: [id])
    organizationId String
    members        TeamMember[]
    projects       Project[]

    @@allow('read', true)
    @@allow('create,update,delete', members?[role == 'ADMIN' || role == 'OWNER'])
    @@meta('doc:category', 'Identity')
    @@meta('doc:since', '1.0')
}

On this page: Mixins · Fields · Relationships · Access Policies · Validation Rules

🧩 Mixins

Reusable field groups mixed into this model.

📋 Fields

All fields defined on this entity, including inherited fields from mixins and parent models.

Field Type Required Default Attributes Source Description
createdAt DateTime Yes now() Timestamps
updatedAt DateTime Yes @updatedAt Timestamps
id String Yes cuid() @id
name String Yes @length(1, 80) Team display name.
description String? No Optional description of the team's purpose.
organization Organization Yes @relation(fields: [organizationId], references: [id])
organizationId String Yes
members TeamMember[] No
projects Project[] No

🔗 Relationships

Foreign key relationships to other models in the schema.

Field Related Model Type
members TeamMember One→Many
organization Organization Many→One
projects Project One→Many

diagram

🔐 Access Policies

ZenStack access control rules that determine who can read, create, update, or delete records.

Important

Operations are denied by default. @@allow rules grant access; @@deny rules override any allow.

Operation Rule Effect
read true Allow
create,update,delete `members?[role == 'ADMIN'

✅ Validation Rules

Field-level and model-level validation constraints enforced at the ORM layer.

Field Rule
name @length

📚 References


Previous: Task · Next: TeamMember