fix: 修 POST /api/v1/conversations 的 MissingGreenlet(会话建不出来导致转人工 404)

- public_platform_service: 创建 ConversationSession 时显式赋值四个 server_default 时间列,
  否则 flush() 后需回读数据库生成值,在 async session 里以同步属性访问触发
  MissingGreenlet,接口 500,连带转人工一直报会话不存在
- portal: 客服改用 C001 真实建会话;转人工改传 reason_code/reason_detail(原 reason 属额外字段 422)
- portal: 投顾查客户投资目标走 customers/{id} 变体
- seed/grant: 补 investment-goal:{read,write,confirm}:customer 三个动态拼出的权限码
  (data_scope=own_customers,投顾只看名下客户)
This commit is contained in:
2026-09-12 15:37:36 +08:00
parent 14f5078491
commit 615032ab00
4 changed files with 67 additions and 10 deletions
+6
View File
@@ -80,6 +80,12 @@ ADVISOR_GRANTED_CODES: tuple[str, ...] = (
"investment-goal:read:self",
"investment-goal:write:self", # 新建投资目标
"investment-goal:confirm:self", # 与客户确认目标
# 看/建/确认**客户**(而非自己)的投资目标。这三个码是 `investment_goal_service.py`
# 按 `customer_id == 自己` 动态拼出来的,`data_scope=own_customers`:
# 只有客户在投顾名下才放行 —— 投顾服务的本来就是别人的钱。
"investment-goal:read:customer",
"investment-goal:write:customer",
"investment-goal:confirm:customer",
"investment-goal:review",
"investment-goal:publish",
"portfolio-analysis:read:self",