fix: 修复后端代码违规并更新协议文档
- 修复 notifications 模块 datetime.now() 缺少时区问题 - 用 ApiProblemError 替换 BaseService 中的 HTTPException - 更新协议文档:添加错误码、繁体字段、邀请相关协议 - 升级 Docker 镜像版本
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# Invite Protocol (Frontend <-> Backend)
|
||||
|
||||
This document defines the invite code contract for authenticated users.
|
||||
|
||||
Protocol verification status:
|
||||
|
||||
- Backend route source: `backend/src/v1/invite/router.py`
|
||||
- Backend service source: `backend/src/v1/invite/service.py`
|
||||
- Backend schema source: `backend/src/v1/invite/schemas.py`
|
||||
- Frontend mapping source: `apps/lib/features/settings/data/apis/invite_api.dart`
|
||||
|
||||
## Compatibility strategy
|
||||
|
||||
- Additive evolution only.
|
||||
- Existing response fields are stable and must remain backward-compatible.
|
||||
|
||||
## Route
|
||||
|
||||
### GET /api/v1/invite/me
|
||||
|
||||
Get the current user's invite code information.
|
||||
|
||||
**Authorization**: Requires authenticated session. User identity from JWT `sub`.
|
||||
|
||||
**Response (200)**:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "ABC123XYZ",
|
||||
"used_count": 5
|
||||
}
|
||||
```
|
||||
|
||||
Field rules:
|
||||
|
||||
- `code`: string, unique invite code assigned to the user
|
||||
- `used_count`: integer `>= 0`, number of times this code has been used
|
||||
|
||||
## Error contract linkage
|
||||
|
||||
- RFC7807 + extension `code`, optional `params`.
|
||||
- Shared registry: `docs/protocols/common/http-error-codes.md`.
|
||||
- Error codes for this feature:
|
||||
- `INVITE_CODE_NOT_FOUND` (404): Invite code not found for current user
|
||||
|
||||
## Data model linkage
|
||||
|
||||
- Invite codes are stored in `invite_codes` table.
|
||||
- See `docs/protocols/common/user-points-chat-data-protocol.md` for `profiles.referred_by` field.
|
||||
Reference in New Issue
Block a user