Files
timemaster/backend/app/models/smtp_config.py
T
sysops 1fedd683e0 Initial commit – TimeMaster Zeiterfassung & HR-Tool
Stand: agent-06 (Audit-Log), agent-05 (Krankmeldung), agent-07 Phase 1 (Personalnummer),
Busylight-Pull-Integration, TOTP/2FA, Abwesenheiten, Zeiterfassung, Kiosk-Grundgerüst.
Migrations 0001–0023 deployed auf 192.168.1.137 + .164.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 20:03:27 +02:00

33 lines
1.3 KiB
Python

"""
SMTP-Konfiguration pro Firma.
Passwort wird Fernet-verschlüsselt gespeichert (gleiche Methode wie ldap_service).
"""
import uuid
from sqlalchemy import Boolean, Integer, String, Text, UniqueConstraint
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import Base
class SmtpConfig(Base):
__tablename__ = "smtp_configs"
__table_args__ = (UniqueConstraint("company_id"),)
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
company_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), nullable=False, index=True)
host: Mapped[str] = mapped_column(String(255), nullable=False)
port: Mapped[int] = mapped_column(Integer, default=587, nullable=False)
use_tls: Mapped[bool] = mapped_column(Boolean, default=False) # SMTPS port 465
use_starttls: Mapped[bool] = mapped_column(Boolean, default=True) # STARTTLS port 587
username: Mapped[str | None] = mapped_column(String(255))
password_encrypted: Mapped[str | None] = mapped_column(Text)
from_email: Mapped[str] = mapped_column(String(255), nullable=False)
from_name: Mapped[str] = mapped_column(String(255), default="TimeMaster", nullable=False)
is_enabled: Mapped[bool] = mapped_column(Boolean, default=True)