feat: 添加 Analytics 分析功能(行为追踪、错误码、协议更新)

This commit is contained in:
qzl
2026-04-02 11:52:23 +08:00
parent b101826de5
commit 7b6dbe72c3
24 changed files with 682 additions and 52 deletions
+30
View File
@@ -4,6 +4,18 @@
Defines the backend/frontend data contract for `/api/v1/todos`.
## Endpoints
| Method | Path | Description |
|---|---|---|
| POST | `/api/v1/todos` | Create todo |
| GET | `/api/v1/todos` | List todos (supports status/priority filter) |
| GET | `/api/v1/todos/{todo_id}` | Get todo detail |
| PATCH | `/api/v1/todos/reorder` | Batch reorder todos |
| PATCH | `/api/v1/todos/{todo_id}` | Update todo |
| POST | `/api/v1/todos/{todo_id}/complete` | Mark todo completed |
| DELETE | `/api/v1/todos/{todo_id}` | Delete todo |
## Field Definitions
- `id`: string (UUID)
@@ -31,6 +43,24 @@ Defines the backend/frontend data contract for `/api/v1/todos`.
- optional: `title`, `description`, `priority`, `order`, `status`, `schedule_item_ids`
- `order` is interpreted inside the todo's final `priority` quadrant.
### List Todos (`GET /api/v1/todos`)
- query `status`: `pending | done | canceled` (optional)
- query `priority`: integer in `[1, 4]` (optional)
### Reorder Todos (`PATCH /api/v1/todos/reorder`)
- body: `{ items: Array<{ id, priority, order }> }`
- each item requires:
- `id`: UUID
- `priority`: integer in `[1, 4]`
- `order`: integer `>= 0`
### Complete Todo (`POST /api/v1/todos/{todo_id}/complete`)
- body: `{}`
- effect: sets todo status to `done` and updates `completed_at`
## Ordering Rules
- Todo list API returns items sorted by `priority ASC`, then `order ASC`.