sync: 鍚屾灞€鍩熺綉鏈€鏂颁唬鐮?(source master @ b69568e4)
This commit is contained in:
1 parent
4f7f07504a
commit
8bc8b0e082
1651 files changed
+278599
-11416
No files matched your search
+25
-5
@@ -1,9 +1,10 @@
|
||||
"""ORM model for sidebar-menu overrides (菜单管理).
|
||||
|
||||
Global / shared — there is no ``user_id`` scoping; every account sees the same
|
||||
menu layout. The static menu tree (icons / routes / adminOnly) lives in the
|
||||
frontend code; this table only stores per-node **overrides** keyed by the static
|
||||
node id (or an injected iframe light-app node id ``light-app-<appId>``):
|
||||
``menu_overrides`` stores the administrator's shared default. Personal layouts
|
||||
live separately in ``user_menu_override_configs`` as complete snapshots. The
|
||||
static menu tree (icons / routes / adminOnly) lives in the frontend code; the
|
||||
default table stores per-node **overrides** keyed by the static node id (or an
|
||||
injected iframe light-app node id ``light-app-<appId>``):
|
||||
|
||||
- ``parent_id`` — the effective parent node id (NULL = top level). Re-parenting
|
||||
a node moves its whole subtree.
|
||||
@@ -23,7 +24,7 @@ from sqlalchemy import Boolean, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from deerflow.persistence.base import Base
|
||||
from deerflow.persistence.types import BeijingDateTime
|
||||
from deerflow.persistence.types import BeijingDateTime, PortableJSON
|
||||
|
||||
|
||||
class MenuOverrideRow(Base):
|
||||
@@ -40,3 +41,22 @@ class MenuOverrideRow(Base):
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
BeijingDateTime(), default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC)
|
||||
)
|
||||
|
||||
|
||||
class UserMenuOverrideConfigRow(Base):
|
||||
"""A complete personal sidebar-menu snapshot.
|
||||
|
||||
Keeping the snapshot in one row is deliberate: the presence of a row is
|
||||
the ``has_user_override`` bit, while the node ids in ``overrides`` are the
|
||||
user's known-node set. This lets us distinguish an administrator-added
|
||||
node from an old node the user intentionally left at its default value.
|
||||
"""
|
||||
|
||||
__tablename__ = "user_menu_override_configs"
|
||||
|
||||
user_id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
||||
overrides: Mapped[list[dict]] = mapped_column(PortableJSON(), nullable=False, default=list)
|
||||
updated_by: Mapped[str | None] = mapped_column(String(64))
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
BeijingDateTime(), default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC)
|
||||
)
|
||||
Reference in new issue
Block a user