feat: 业务链条发布审核流程 + 编辑器去除岗位职责输入框
- 发布改为可选「确认审核 / 直接发布」:链条编辑页与圆桌「业务链条」弹窗行为一致;审核中可撤回 - 管理员在业务链条列表新增「待审核」筛选,审核发布后进入公共库 - 后端 roundtable_chains 新增 pending_review 字段(启动期自动补列)与 scope=pending 筛选;新增审核流程测试 - 编辑器席位去掉「岗位职责」输入框(保存时存量值原样保留)
This commit is contained in:
1 parent
40d06b781a
commit
8c3d6a02fc
9 files changed
+462
-81
No files matched your search
@@ -6,7 +6,7 @@ following this order. Bound to the requesting user (not the browser), so it
|
||||
follows the account across devices/sessions — same model as roundtable drafts.
|
||||
|
||||
Routes (prefix ``/api/roundtable-chains``):
|
||||
GET "" list chains (``scope=mine``默认 / ``public`` / ``all`` 仅管理员)
|
||||
GET "" list chains (``scope=mine``默认 / ``public`` / ``pending`` / ``all`` 后两者仅管理员)
|
||||
POST "" create a chain
|
||||
GET "/{chain_id}" one chain
|
||||
PUT "/{chain_id}" partial update (title / description / seats)
|
||||
@@ -96,6 +96,9 @@ class ChainResponse(BaseModel):
|
||||
is_public: bool = False
|
||||
# 启停状态:True = 启用(可选入研讨);False = 停用。缺省 True。
|
||||
enabled: bool = True
|
||||
# 「待审核」标记:True = owner 已提交审核(等待管理员在「待审核」筛选里发布);
|
||||
# 管理员发布时随 is_public=True 一起清回 False。缺省 False。
|
||||
pending_review: bool = False
|
||||
# 是否当前用户所有(仅本人可编辑 / 删除 / 发布;公共筛选里别人的链条 is_mine=False)。
|
||||
is_mine: bool = True
|
||||
# 配置者(owner)的 user_id 及解析后的可读用户名(email)。owner_name 由路由层
|
||||
@@ -140,6 +143,9 @@ class ChainUpdateRequest(BaseModel):
|
||||
is_public: bool | None = None
|
||||
# 启停开关(True 启用 / False 停用);仅 owner / 管理员可改。omit 不改。
|
||||
enabled: bool | None = None
|
||||
# 「待审核」开关(True = 提交审核,owner 在编辑器发起;False = 清除,管理员发布时
|
||||
# 随 is_public=True 一起提交)。omit 不改。
|
||||
pending_review: bool | None = None
|
||||
|
||||
|
||||
# ── helpers ──────────────────────────────────────────────────────────────
|
||||
@@ -303,13 +309,15 @@ async def list_chains(request: Request, scope: str = "mine") -> ChainListRespons
|
||||
``scope`` 查询参数(筛选):
|
||||
- ``mine``(默认):仅当前用户自己的链条;
|
||||
- ``public``:所有**已发布**的公共链条(任何账号均可查看 / 选入研讨);
|
||||
- ``pending``:所有**待审核**(``pending_review=True``)链条(**仅管理员**;
|
||||
非管理员请求 ``pending`` 退化为 ``mine``);
|
||||
- ``all``:所有账号的全部链条(**仅管理员**;非管理员请求 ``all`` 退化为 ``mine``)。
|
||||
其余值按 ``mine`` 处理。
|
||||
"""
|
||||
is_admin = _is_admin(request)
|
||||
normalized_scope = scope if scope in ("mine", "public", "all") else "mine"
|
||||
# 非管理员请求 all → 退化为 mine,绝不越权。
|
||||
if normalized_scope == "all" and not is_admin:
|
||||
normalized_scope = scope if scope in ("mine", "public", "pending", "all") else "mine"
|
||||
# 非管理员请求 pending / all → 退化为 mine,绝不越权。
|
||||
if normalized_scope in ("pending", "all") and not is_admin:
|
||||
normalized_scope = "mine"
|
||||
store = _get_store(request)
|
||||
user_id = _current_user_id(request)
|
||||
|
||||
Reference in new issue
Block a user