Task Model
What is a task?​
A task represents one role's assignment to work on an episode. It links a role to a specific episode, with an optional user assigned.
Tasks are created automatically when roles are added in the Episode Creators Modal. They are not created manually by end users.
Fields​
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier |
title | string | Task name (typically the role name) |
description | string? | Optional description |
url | string? | Optional reference link |
status | enum | to-do / in-progress / blocked / done |
roleId | UUID? | The role this task is for |
userId | UUID? | The assigned user (nullable — task can exist without a user) |
Statuses​
| Status | Meaning |
|---|---|
to-do | Not started |
in-progress | Actively being worked on |
blocked | Waiting on something external |
done | Completed |
Episode linking​
Tasks are linked to episodes via the episode_tasks join table:
tasks ──── episode_tasks ──── episodes
(order: int)
The order field determines which stage the task belongs to in the episode's workflow. Stage 0 = first stage, stage 1 = second stage, etc.
When a task is deleted, its episode_tasks rows are removed automatically via ON DELETE CASCADE.
API endpoints​
| Method | Endpoint | Description |
|---|---|---|
GET | /api/tasks?userId=<id> | Get tasks for a specific user |
GET | /api/tasks/all | Get all tasks (Admin) — supports filter=today|monthly|range |
POST | /api/tasks | Create a task |
PATCH | /api/tasks/:id | Update task's assigned user (pass userId: null to clear) |
PATCH | /api/tasks/:id/status | Update task status |
POST | /api/tasks/:id/episodes | Link task to an episode at a given order/stage |
DELETE | /api/tasks/:id/episodes/:episodeId | Unlink task from an episode |
DELETE | /api/tasks/:id | Delete task entirely |
My Tasks page​
Users can view their own tasks (filtered by userId) on the My Tasks page. Admins can see all tasks with date filtering (today, this month, or a custom date range).