Skip to content

Latest commit

 

History

History
151 lines (105 loc) · 5.47 KB

File metadata and controls

151 lines (105 loc) · 5.47 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 / Project

🗃️ Project Model

A project organizes tasks under a team within an organization.

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


Declaration · showcase.zmodel
model Project with Timestamps {
    id             String       @id @default(cuid())
    name           String       @length(1, 100)
    description    String?
    archived       Boolean      @default(false)
    taskCount      Int          @computed
    completionRate Float        @computed
    hasOverdueTasks Boolean     @computed
    organization   Organization @relation(fields: [organizationId], references: [id])
    organizationId String
    team           Team?        @relation(fields: [teamId], references: [id])
    teamId         String?
    tasks          Task[]
    tags           Tag[]

    @@allow('read', true)
    @@allow('create,update', true)
    @@deny('delete', archived)
    @@index([organizationId])
    @@meta('doc:category', 'Work')
    @@meta('doc:since', '1.0')
}

On this page: Mixins · Fields · Relationships · Access Policies · Indexes · Validation Rules · Used in Procedures

🧩 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, 100) The project name.
description String? No Detailed description of the project scope and goals.
archived Boolean Yes false
taskCount Int computed Yes Total number of tasks in this project.
completionRate Float computed Yes Percentage of completed tasks (0.0–1.0).
hasOverdueTasks Boolean computed Yes Whether the project has any tasks past their due date.
organization Organization Yes @relation(fields: [organizationId], references: [id])
organizationId String Yes
team Team? No @relation(fields: [teamId], references: [id])
teamId String? No
tasks Task[] No
tags Tag[] No

🔗 Relationships

Foreign key relationships to other models in the schema.

Field Related Model Type
organization Organization Many→One
tags Tag One→Many
tasks Task One→Many
team Team Many→One?

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 true Allow
delete archived Deny

📇 Indexes

Database indexes defined on this model for query performance.

Fields Type
[organizationId] Index

✅ Validation Rules

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

Field Rule
name @length

⚡ Used in Procedures

Procedures that reference this entity as a parameter or return type.


📚 References


Previous: Organization · Next: Tag