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
+10
@@ -64,6 +64,8 @@ class RoundtableChainRepository:
|
||||
"is_public": bool(getattr(row, "is_public", False)),
|
||||
# 启停状态:缺省 True(存量行 / 补列前视为启用)。
|
||||
"enabled": bool(getattr(row, "enabled", True)),
|
||||
# 「待审核」标记:True = owner 已提交审核、等待管理员发布;发布时清回 False。
|
||||
"pending_review": bool(getattr(row, "pending_review", False)),
|
||||
"is_mine": (current_user_id is None) or (row.user_id == current_user_id),
|
||||
# 配置者(owner)的 user_id;路由层据此解析成可读用户名(owner_name)。
|
||||
"owner_id": row.user_id,
|
||||
@@ -79,12 +81,16 @@ class RoundtableChainRepository:
|
||||
``scope``:
|
||||
- ``"mine"``(默认):仅当前用户自己的链条;
|
||||
- ``"public"``:所有**已发布**(``is_public=True``)链条,含本人发布的;
|
||||
- ``"pending"``:所有**待审核**(``pending_review=True``)链条,**仅管理员**(由路由层
|
||||
校验后传 ``is_admin=True``;非管理员误传则按 ``"mine"`` 退化,绝不越权);
|
||||
- ``"all"``:所有账号的全部链条(**仅管理员**,由路由层校验后传 ``is_admin=True``;
|
||||
非管理员误传则按 ``"mine"`` 退化,绝不越权)。
|
||||
其余值按 ``"mine"`` 处理。``is_mine`` 标记每条是否本人所有,供前端判断可否编辑。
|
||||
"""
|
||||
if scope == "public":
|
||||
cond = RoundtableChainRow.is_public.is_(True)
|
||||
elif scope == "pending" and is_admin:
|
||||
cond = RoundtableChainRow.pending_review.is_(True)
|
||||
elif scope == "all" and is_admin:
|
||||
cond = None
|
||||
else:
|
||||
@@ -125,6 +131,7 @@ class RoundtableChainRepository:
|
||||
gather_first=bool(data.get("gather_first") or False),
|
||||
is_public=bool(data.get("is_public") or False),
|
||||
enabled=True if data.get("enabled") is None else bool(data.get("enabled")),
|
||||
pending_review=bool(data.get("pending_review") or False),
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
)
|
||||
@@ -149,6 +156,7 @@ class RoundtableChainRepository:
|
||||
gather_first=_UNSET,
|
||||
is_public=_UNSET,
|
||||
enabled=_UNSET,
|
||||
pending_review=_UNSET,
|
||||
is_admin: bool = False,
|
||||
) -> dict[str, Any] | None:
|
||||
async with self._sf() as session:
|
||||
@@ -176,6 +184,8 @@ class RoundtableChainRepository:
|
||||
row.is_public = bool(is_public)
|
||||
if enabled is not _UNSET and enabled is not None:
|
||||
row.enabled = bool(enabled)
|
||||
if pending_review is not _UNSET and pending_review is not None:
|
||||
row.pending_review = bool(pending_review)
|
||||
row.updated_at = datetime.now(UTC)
|
||||
await session.commit()
|
||||
await session.refresh(row)
|
||||
|
||||
Reference in new issue
Block a user