Files
fastapi-best-architecture/backend/app/admin/model/sys_config.py
T
Wu Clan 0e7cef5b6c Update system config to dynamic (#447)
* Update system config to be dynamic

* update the configuration interface

* custom parameters are allowed

* update apis

* add more code

* finish

* fix bugs
2024-11-10 07:30:05 +08:00

22 lines
856 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sqlalchemy import Boolean, String
from sqlalchemy.dialects.mysql import LONGTEXT
from sqlalchemy.orm import Mapped, mapped_column
from backend.common.model import Base, id_key
class Config(Base):
"""系统配置表"""
__tablename__ = 'sys_config'
id: Mapped[id_key] = mapped_column(init=False)
name: Mapped[str] = mapped_column(String(20), comment='名称')
type: Mapped[str | None] = mapped_column(String(20), server_default=None, comment='类型')
key: Mapped[str] = mapped_column(String(50), unique=True, comment='键名')
value: Mapped[str] = mapped_column(LONGTEXT, comment='键值')
is_frontend: Mapped[str] = mapped_column(Boolean, default=False, comment='是否前端')
remark: Mapped[str | None] = mapped_column(LONGTEXT, default=None, comment='备注')