feat: 日历分享改为按手机号+好友关系校验

This commit is contained in:
qzl
2026-03-30 11:37:41 +08:00
parent 60318b7aaa
commit 9fb2a6857b
20 changed files with 624 additions and 230 deletions
+19 -3
View File
@@ -139,7 +139,7 @@ Base URL: `/api/v1/schedule-items`
说明:
- `subscribers` 列表仅包含状态为 `active` 的订阅者
- `phone` 字段来自 Supabase Auth,用于显示订阅者手机号
- 前端显示优先级:`phone ?? username ?? userId`
- 前端显示优先级:`phone ?? username ?? user_id`
### ScheduleItemShareRequest
@@ -152,7 +152,9 @@ Base URL: `/api/v1/schedule-items`
}
```
说明:`permission_view`、`permission_edit`、`permission_invite` 为布尔值,内部会转换为位掩码整数:
说明:
- 分享目标仅支持 `phone`E.164 中国手机号,如 `+8613812345678`),不接受 `user_id` 作为分享入参。
- `permission_view`、`permission_edit`、`permission_invite` 为布尔值,内部会转换为位掩码整数:
- `permission_view = 1`
- `permission_invite = 2`
- `permission_edit = 4`
@@ -270,7 +272,7 @@ Base URL: `/api/v1/schedule-items`
## 6) POST `/{item_id}/share`
分享日程给其他用户
按手机号分享日程给已接受好友
### Path Parameters
@@ -280,10 +282,24 @@ Base URL: `/api/v1/schedule-items`
`ScheduleItemShareRequest` 对象。
- `phone`: 分享目标手机号(E.164,中国号段,如 `+8613xxxxxxxxx`
- `permission_view`: 是否授予查看权限
- `permission_edit`: 是否授予编辑权限
- `permission_invite`: 是否授予继续邀请权限
### Response
`ScheduleItemShareResponse` 对象。
### Error Responses
| Status | Code | 说明 |
|--------|------|------|
| 403 | `SCHEDULE_ITEM_SHARE_FORBIDDEN` | 当前用户无分享权限 |
| 403 | `SCHEDULE_ITEM_SHARE_PERMISSION_EXCEEDED` | 授权位超过当前用户可授予上限 |
| 403 | `SCHEDULE_ITEM_SHARE_TARGET_NOT_FRIEND` | 仅允许分享给已接受好友 |
| 404 | `SCHEDULE_ITEM_NOT_FOUND` | 日程不存在 |
---
## 7) POST `/{item_id}/accept`
@@ -115,6 +115,7 @@ When creating/modifying/deprecating any code, this table must be updated in the
| `SCHEDULE_ITEM_PAGE_INVALID` | schedule_items | 400 | Pagination `page` must be greater than or equal to 1 |
| `SCHEDULE_ITEM_PAGE_SIZE_INVALID` | schedule_items | 400 | Pagination `page_size` out of allowed range |
| `SCHEDULE_ITEM_SHARE_FORBIDDEN` | schedule_items | 403 | Current user cannot share this schedule item |
| `SCHEDULE_ITEM_SHARE_TARGET_NOT_FRIEND` | schedule_items | 403 | Recipient must be an accepted friend of current user |
| `SCHEDULE_ITEM_FORBIDDEN` | schedule_items | 403 | Current user does not have permission to edit this schedule item |
| `SCHEDULE_ITEM_SHARE_PERMISSION_EXCEEDED` | schedule_items | 403 | Requested share permission exceeds inviter permission |
| `SCHEDULE_ITEM_SUBSCRIPTION_ALREADY_ACTIVE` | schedule_items | 400 | Recipient already has active subscription |