任务
任务(Task)属于项目。状态机:TODO → IN_PROGRESS → REVIEW → DONE,可旁路到 BLOCKED。
数据模型
interface Task {
id: string;
projectId: string;
title: string;
description: string | null;
status: "TODO" | "IN_PROGRESS" | "BLOCKED" | "REVIEW" | "DONE";
priority: number; // 1-5,1 = 最高
assigneeId: string | null;
reporterId: string | null;
startDate: string | null;
dueDate: string | null;
createdAt: string;
updatedAt: string;
}
Endpoints
列出任务
GET /openapi/v1/resource/task/list?projectId=...&status=...
status 是可选过滤;省略时返回所有状态。
创建任务
POST /openapi/v1/resource/task/create
Body:
{
"projectId": "cms5brzya0009zp13m0hmf79x",
"title": "实现登录页 OAuth",
"description": "接入 GitHub OAuth",
"priority": 2,
"assigneeId": "cms5brzxv0001zp1393jjtqoe",
"dueDate": "2026-09-15T00:00:00.000Z"
}
更新任务状态
PATCH /openapi/v1/resource/task/update
Body:
{
"taskId": "cms...",
"status": "IN_PROGRESS"
}
合法的状态转移:
| 从 | 到 |
|---|---|
TODO | IN_PROGRESS / BLOCKED / DONE(跳过 review) |
IN_PROGRESS | REVIEW / BLOCKED / TODO(退回) |
REVIEW | DONE / IN_PROGRESS(退回) |
BLOCKED | TODO / IN_PROGRESS |
DONE | IN_PROGRESS(reopen) |
非法转移返回 400 INVALID_TRANSITION。
Scope
- 读:
tasks:read - 写:
tasks:write