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
+1
View File
@@ -11,6 +11,7 @@ scheduler computation, and Flutter settings pages.
- `owner_id`: UUID
- `title`: string
- `bootstrap_key`: string | null (引导配置键,用于标识预设任务模板)
- `is_system`: boolean (`bootstrap_key != null` 时为 `true`,只读派生字段)
- `config`: object
- `input_template`: string
- `enabled_tools`: string[]
+1 -2
View File
@@ -60,7 +60,7 @@ Base URL: `/api/v1/inbox/messages`
"phone": "string | null"
},
"summary": "string",
"permission": "int (1=view, 4=edit, 8=invite)",
"permission": "int (1=view, 2=invite, 4=edit, 8=delete, 15=owner)",
"action": "pending"
}
```
@@ -141,7 +141,6 @@ Base URL: `/api/v1/inbox/messages`
"message_type": "InboxMessageType",
"schedule_item_id": "uuid | null",
"friendship_id": "uuid | null",
"group_id": "uuid | null",
"content": "CalendarInviteContent | CalendarUpdateContent | CalendarDeleteContent | FriendshipContent | null",
"is_read": "boolean",
"status": "InboxMessageStatus",
+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`.
+26 -1
View File
@@ -12,6 +12,7 @@ Base URL: `/api/v1/users`
|---|---|---|
| GET | `/me` | 获取当前用户信息 |
| PATCH | `/me` | 更新当前用户信息 |
| POST | `/me/avatar` | 上传头像图片并更新头像地址 |
| POST | `/search` | 搜索用户 |
| GET | `/{user_id}` | 获取指定用户信息 |
@@ -106,7 +107,31 @@ Base URL: `/api/v1/users`
---
## 4) GET `/{user_id}`
## 4) POST `/me/avatar`
上传头像(`multipart/form-data`)。
### Request
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `file` | file | 是 | 图片文件(`image/jpeg` / `image/png` / `image/webp` |
### Response
```json
{
"url": "https://..."
}
```
说明:
- 上传成功后后端会同步更新当前用户 `avatar_url`
- 文件大小上限由后端配置 `storage.avatar.max_size_mb` 控制。
---
## 5) GET `/{user_id}`
获取指定用户信息。