feat(weibo): 支持管理员强制转入工作台且不影响原使用人

This commit is contained in:
yml
2026-11-12 12:05:26 +08:00
parent 11b5a4d938
commit 31045e0f2e
11 changed files with 604 additions and 56 deletions
+10 -1
View File
@@ -8,6 +8,7 @@ from sqlalchemy import (
JSON,
BigInteger,
Boolean,
CheckConstraint,
Computed,
ForeignKey,
Index,
@@ -989,6 +990,9 @@ class WeiboWorkbenchAccount(Base):
nullable=False,
index=True,
)
# 普通用户固定为 1;超级管理员的并行工作台映射为 NULL。
# MySQL 唯一索引允许多个 NULL,因此管理员附加映射不会挤掉原使用人。
exclusive_slot: Mapped[int | None] = mapped_column(Integer, nullable=True)
created_at: Mapped[datetime] = mapped_column(UTCDateTime, default=_utcnow)
__table_args__ = (
@@ -999,7 +1003,12 @@ class WeiboWorkbenchAccount(Base):
),
UniqueConstraint(
"account_id",
name="uq_weibo_workbench_account_owner",
"exclusive_slot",
name="uq_weibo_workbench_account_exclusive",
),
CheckConstraint(
"exclusive_slot IS NULL OR exclusive_slot = 1",
name="ck_weibo_workbench_exclusive_slot",
),
)