Tasks Module
Task management, AI reprioritization, and seed data
The Tasks module manages cross-workspace tasks. Source: packages/server/src/modules/tasks/.
REST Endpoints
All endpoints are prefixed with /api/v1/tasks and require ClerkAuthGuard.
| Method | Path | Description |
|---|---|---|
| POST | /tasks | Create a task |
| GET | /tasks | List tasks with filters |
| GET | /tasks/:id | Get a single task |
| PATCH | /tasks/:id | Update task fields |
| DELETE | /tasks/:id | Delete a task |
| POST | /tasks/reorder | Bulk reorder by sort order |
| POST | /tasks/reprioritize | Apply AI-driven priority changes |
| POST | /tasks/seed | Seed onboarding tasks |
Filters for GET /tasks
| Param | Type | Description |
|---|---|---|
status | TaskStatus | Filter by status |
priority | TaskPriority | Filter by priority |
assigneeId | string | Filter by assignee |
workspaceId | string | Filter by workspace |
tags | string[] | Filter by tags (any match) |
dueBefore | ISO date | Tasks due before this date |
dueAfter | ISO date | Tasks due after this date |
Task Service (services/tasks.service.ts)
create(orgId, userId, dto)
Creates a new task. Fields:
| Field | Required | Description |
|---|---|---|
title | Yes | Task title |
description | No | Detailed description |
status | No | Default: TODO |
priority | No | Default: MEDIUM |
assigneeId | No | Assignee user ID (null = unassigned) |
workspaceId | No | Workspace (null = org-level) |
dueDate | No | ISO date string |
tags | No | String array |
metadata | No | JSON object |
Unassigned tasks (assigneeId: null) are visible to all org members.
update(orgId, taskId, dto)
Partial update. When status is set to DONE, completedAt is automatically set to now(). When status changes away from DONE, completedAt is cleared.
reorder(orgId, taskIds)
Accepts an ordered array of task IDs. Updates sortOrder for each task to reflect the new order. Used for drag-and-drop reordering in the Hub.
reprioritize(orgId, changes)
Applies AI-driven priority and sort order changes to multiple tasks in one call. Each change specifies:
{
taskId: string;
priority?: TaskPriority;
sortOrder?: number;
reason: string; // required — why the AI changed the priority
}Changes are applied sequentially via individual repository updates.
seedOnboardingTasks(orgId, userId, workspaceId?)
Creates 6 sample tasks to demonstrate the workspace functionality during onboarding. Called by POST /tasks/seed.
Task Status & Priority
TaskStatus
| Value | Description |
|---|---|
TODO | Not started |
IN_PROGRESS | Being worked on |
DONE | Completed (sets completedAt) |
CANCELLED | Cancelled (does not set completedAt) |
TaskPriority
| Value | Description |
|---|---|
LOW | Low urgency |
MEDIUM | Default priority |
HIGH | High urgency |
URGENT | Needs immediate attention |
Unassigned Tasks
Tasks with assigneeId = null are shared tasks visible to all members of the org. The Hub's task filter has an Unassigned view for these.