Task Model
The Task entity represents an individual to-do item with completion tracking and category assignment.Schema Definition
Unique identifier (UUID v4) automatically generated by the API.Example:
"550e8400-e29b-41d4-a716-446655440000"The task title or name.Validation:
- Minimum length: 3 characters
- Maximum length: 25 characters
- Automatically trimmed (whitespace removed)
"Complete documentation"Optional detailed description of the task.Validation:
- Maximum length: 25 characters
- Automatically trimmed
"Write API reference docs"Indicates whether the task has been completed.Behavior:
- Defaults to
falsewhen not specified - When changed from
falsetotrue,finishedAtis automatically set - When changed from
truetofalse,finishedAtis automatically removed
trueThe UUID of the category this task belongs to, or the special value
"uncategorized".Behavior:- Defaults to
"uncategorized"when not specified or empty string provided - Can be set to any valid TaskCategory
_id - When a category is deleted, all associated tasks are reassigned to
"uncategorized"
"550e8400-e29b-41d4-a716-446655440000" or "uncategorized"ISO 8601 timestamp indicating when the task was created.Behavior:
- Automatically set by the API on creation
- Read-only (cannot be modified)
- Format:
YYYY-MM-DDTHH:mm:ss.sssZ
"2026-03-11T14:30:00.000Z"ISO 8601 timestamp indicating when the task was last modified.Behavior:
- Automatically set by the API on every update operation
- Read-only (cannot be manually set)
- Format:
YYYY-MM-DDTHH:mm:ss.sssZ
"2026-03-11T15:45:00.000Z"ISO 8601 timestamp indicating when the task was marked as completed.Behavior:
- Automatically set when
completedchanges fromfalsetotrue - Automatically removed when
completedchanges fromtruetofalse - Read-only (cannot be manually set)
nullor absent for incomplete tasks- Format:
YYYY-MM-DDTHH:mm:ss.sssZ
"2026-03-11T16:00:00.000Z" or nullComplete Example
TaskCategory Model
The TaskCategory entity represents a category or label for organizing tasks.Schema Definition
Unique identifier (UUID v4) automatically generated by the API.Example:
"a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d"The category name.Validation:
- Minimum length: 2 characters
- Maximum length: 25 characters
- Automatically trimmed (whitespace removed)
- Should be unique (though not enforced at database level)
"Work", "Personal", "Shopping"Complete Example
TaskCategory Example
Validation Rules Summary
All validation is performed using Zod schemas on the server side.
Task Validation
| Field | Type | Required | Min | Max | Default |
|---|---|---|---|---|---|
| title | string | Yes | 3 | 25 | - |
| description | string | No | - | 25 | - |
| completed | boolean | No | - | - | false |
| categoryId | string | No | - | - | “uncategorized” |
TaskCategory Validation
| Field | Type | Required | Min | Max | Default |
|---|---|---|---|---|---|
| name | string | Yes | 2 | 25 | - |
Database Implementation
The API uses db-local for data persistence.Special Values
”uncategorized”
The string literal"uncategorized" is a special value used for tasks without a category assignment:
- It is NOT a UUID
- It is the default value when no
categoryIdis provided - Tasks are automatically reassigned to this value when their category is deleted
- You can explicitly set a task’s
categoryIdto empty string ("") to use this default