20 lines
1008 B
Python
20 lines
1008 B
Python
from sqlalchemy import Boolean, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base, TimestampMixin
|
|
|
|
|
|
class MenuConfig(Base, TimestampMixin):
|
|
__tablename__ = "menu_configs"
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
label: Mapped[str] = mapped_column(String(64))
|
|
path: Mapped[str] = mapped_column(String(128), default="")
|
|
icon: Mapped[str] = mapped_column(String(64), default="")
|
|
sort_order: Mapped[int] = mapped_column(Integer, default=0)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
parent_id: Mapped[str | None] = mapped_column(String(32), ForeignKey("menu_configs.id"), nullable=True)
|
|
menu_type: Mapped[str] = mapped_column(String(16), default="page") # page / group
|
|
menu_target: Mapped[str] = mapped_column(String(16), default="frontend") # frontend / admin / both
|
|
is_default: Mapped[bool] = mapped_column(Boolean, default=False) # default show for new users
|