Files
EnuivTools/backend/admin/models.py
T

21 lines
1.0 KiB
Python

"""系统配置。刷新间隔、验证码选项和管理员口令都在这张表,不使用环境变量。"""
from __future__ import annotations
from sqlalchemy import Boolean, Integer, String, Text, false as sql_false, true as sql_true
from sqlalchemy.orm import Mapped, mapped_column
from euniv.models import Base
class SystemConfig(Base):
__tablename__ = "system_config"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
refresh_interval_minutes: Mapped[int] = mapped_column(Integer, nullable=False, default=30, server_default="30")
show_manual_jigsaw: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True, server_default=sql_true())
manual_preference: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default=sql_false())
auto_jigsaw_attempts: Mapped[int] = mapped_column(Integer, nullable=False, default=3, server_default="3")
admin_username: Mapped[str] = mapped_column(String(64), nullable=False)
admin_password_cipher: Mapped[str] = mapped_column(Text, nullable=False)