mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
feat(email): add admin notification settings
This commit is contained in:
@@ -3,5 +3,15 @@ from backend.models.user import User
|
||||
from backend.models.check_in_task import CheckInTask
|
||||
from backend.models.check_in_record import CheckInRecord
|
||||
from backend.models.task_template import TaskTemplate
|
||||
from backend.models.email_settings import EmailNotificationSettings
|
||||
|
||||
__all__ = ["Base", "get_db", "init_db", "User", "CheckInTask", "CheckInRecord", "TaskTemplate"]
|
||||
__all__ = [
|
||||
"Base",
|
||||
"get_db",
|
||||
"init_db",
|
||||
"User",
|
||||
"CheckInTask",
|
||||
"CheckInRecord",
|
||||
"TaskTemplate",
|
||||
"EmailNotificationSettings",
|
||||
]
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import Boolean, DateTime, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from backend.models.database import Base
|
||||
|
||||
|
||||
class EmailNotificationSettings(Base):
|
||||
"""系统邮件配置与通知策略设置。"""
|
||||
|
||||
__tablename__ = "email_notification_settings"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, default=1)
|
||||
smtp_server: Mapped[str] = mapped_column(String(255), default="", nullable=False)
|
||||
smtp_port: Mapped[int] = mapped_column(Integer, default=465, nullable=False)
|
||||
smtp_sender_email: Mapped[str] = mapped_column(String(255), default="", nullable=False)
|
||||
smtp_sender_password: Mapped[str] = mapped_column(String(500), default="", nullable=False)
|
||||
smtp_use_ssl: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
notify_token_expiring: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
notify_check_in_success: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), comment="创建时间"
|
||||
)
|
||||
updated_at: Mapped[datetime | None] = mapped_column(
|
||||
DateTime(timezone=True), onupdate=func.now(), comment="更新时间"
|
||||
)
|
||||
Reference in New Issue
Block a user