Some checks failed
Run Tests / test (push) Failing after 1m51s
- Introduced a new table `application_setting` to store configurable application options. - Implemented functions to manage CSS color settings, including loading, updating, and reading environment overrides. - Added a new settings view to render and manage theme colors. - Updated UI to include a settings page with theme color management and environment overrides display. - Enhanced CSS styles for the settings page and sidebar navigation. - Created unit and end-to-end tests for the new settings functionality and CSS management.
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import Boolean, DateTime, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from sqlalchemy.sql import func
|
|
|
|
from config.database import Base
|
|
|
|
|
|
class ApplicationSetting(Base):
|
|
__tablename__ = "application_setting"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
key: Mapped[str] = mapped_column(String(128), unique=True, nullable=False)
|
|
value: Mapped[str] = mapped_column(Text, nullable=False)
|
|
value_type: Mapped[str] = mapped_column(String(32), nullable=False, default="string")
|
|
category: Mapped[str] = mapped_column(String(32), nullable=False, default="general")
|
|
description: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
is_editable: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False
|
|
)
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<ApplicationSetting key={self.key} category={self.category}>"
|