27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
"""
|
|
System Settings Database Model
|
|
"""
|
|
from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, Text
|
|
from sqlalchemy.sql import func
|
|
from app.database import Base
|
|
|
|
|
|
class SystemSettings(Base):
|
|
"""System settings table - stores platform configuration parameters"""
|
|
|
|
__tablename__ = "system_settings"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
key = Column(String(100), unique=True, nullable=False, index=True, comment="Setting key")
|
|
value = Column(Text, nullable=False, comment="Setting value (JSON string or plain text)")
|
|
value_type = Column(String(20), nullable=False, default="string", comment="Value type: string, int, float, bool, json")
|
|
category = Column(String(50), nullable=False, default="general", comment="Setting category")
|
|
label = Column(String(200), nullable=False, comment="Display label")
|
|
description = Column(Text, comment="Setting description")
|
|
is_public = Column(Boolean, default=False, comment="Whether this setting is accessible to frontend")
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
def __repr__(self):
|
|
return f"<SystemSettings(key={self.key}, value={self.value})>"
|