Add platform SMTP and firm wizard invite email
This commit is contained in:
@@ -68,6 +68,38 @@ class EmailSetting(CommonBase):
|
||||
updated_at_utc: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
|
||||
|
||||
class PlatformEmailSetting(CommonBase):
|
||||
"""Platform-level SMTP settings controlled by System Admin.
|
||||
|
||||
Used before a tenant/firm is operational, for example Firm Creation
|
||||
Wizard invites, platform password/reset notices and system security emails.
|
||||
Firm/branch SMTP remains in EmailSetting and is not changed by this table.
|
||||
"""
|
||||
|
||||
__tablename__ = "platform_email_settings"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
|
||||
smtp_host: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
smtp_port: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
smtp_username: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
smtp_password: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
smtp_security: Mapped[str] = mapped_column(String(20), nullable=False, default="SSL") # SSL|STARTTLS|NONE
|
||||
smtp_timeout_seconds: Mapped[int] = mapped_column(Integer, nullable=False, default=20)
|
||||
|
||||
from_email: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
from_name: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
reply_to_email: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
|
||||
send_auth_emails: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True, index=True)
|
||||
|
||||
created_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
|
||||
updated_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
|
||||
created_at_utc: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
updated_at_utc: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
|
||||
|
||||
class EmailTemplate(CommonBase):
|
||||
__tablename__ = "email_templates"
|
||||
__table_args__ = (
|
||||
|
||||
Reference in New Issue
Block a user