mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
ce55cfc6b3
Backfill approved legacy users with verified emails and replace the old unverified-email warning setting with a single approval email policy.
37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
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)
|
|
require_admin_approval_for_registration: Mapped[bool] = mapped_column(
|
|
Boolean, default=True, nullable=False
|
|
)
|
|
require_verified_email_for_approval: 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="更新时间"
|
|
)
|