//////////////////////////////////////////////////////////////////////////////////////////////
// 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 //
//////////////////////////////////////////////////////////////////////////////////////////////
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
Reusable field groups mixed into this model.
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 | — | — | — | — |
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? |
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 |
Database indexes defined on this model for query performance.
| Fields | Type |
|---|---|
[organizationId] |
Index |
Field-level and model-level validation constraints enforced at the ORM layer.
| Field | Rule |
|---|---|
name |
@length |
Procedures that reference this entity as a parameter or return type.
- archiveProject — mutation
Previous: Organization · Next: Tag