28 lines
1.4 KiB
Python
28 lines
1.4 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
from sqlalchemy import String, DateTime, Boolean, Integer, Text
|
||
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
||
|
|
|
||
|
|
from adapters.db.session import Base
|
||
|
|
|
||
|
|
|
||
|
|
class EmailConfig(Base):
|
||
|
|
__tablename__ = "email_configs"
|
||
|
|
|
||
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||
|
|
name: Mapped[str] = mapped_column(String(100), nullable=False, index=True)
|
||
|
|
smtp_host: Mapped[str] = mapped_column(String(255), nullable=False)
|
||
|
|
smtp_port: Mapped[int] = mapped_column(Integer, nullable=False)
|
||
|
|
smtp_username: Mapped[str] = mapped_column(String(255), nullable=False)
|
||
|
|
smtp_password: Mapped[str] = mapped_column(String(255), nullable=False) # Should be encrypted
|
||
|
|
use_tls: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||
|
|
use_ssl: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||
|
|
from_email: Mapped[str] = mapped_column(String(255), nullable=False)
|
||
|
|
from_name: Mapped[str] = mapped_column(String(100), nullable=False)
|
||
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||
|
|
is_default: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
||
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|