27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, DateTime, Integer, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class AppNavConfig(Base):
|
|
__tablename__ = "app_nav_configs"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
key: Mapped[str] = mapped_column(String(50), nullable=False, unique=True, index=True)
|
|
label: Mapped[str] = mapped_column(String(50), nullable=False)
|
|
page_path: Mapped[str] = mapped_column(String(200), nullable=False)
|
|
icon: Mapped[str] = mapped_column(String(50), nullable=False)
|
|
active_icon: Mapped[str] = mapped_column(String(50), nullable=False)
|
|
color: Mapped[str] = mapped_column(String(20), default="#999999")
|
|
active_color: Mapped[str] = mapped_column(String(20), default="#6366f1")
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True, index=True)
|
|
sort_order: Mapped[int] = mapped_column(Integer, default=0)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<AppNavConfig {self.key}>"
|