Files
tessera-ctl/apps/api/src/settings/dto/smtp-config.dto.ts
T
schalli 54121c1721 feat(quick-260914-m97): Fehlermeldungen per E-Mail — Empfaenger in SmtpConfig (Migration), MailService-Anhaenge, Modul bug-reports mit Drossel, PNG-Pruefung und Mandant aus der Sitzung
- SmtpConfig.bugReportRecipient (nullable, additive Migration 20260914170000), DTO @IsOptional @IsEmail, SAFE_SELECT, getBugReportRecipient gebunden
- MailService: Versandkern deliver (wirft, Anhaenge), sendViaTenantTransport bleibt verschluckender Mantel (T-02-12), sendBugReport laesst Fehler durch
- POST /bug-reports: Multipart 4 MiB je Route, alle angemeldeten Rollen, Drossel 5/10 min -> 429, PNG-Signatur -> 400, kein Empfaenger -> 409, Versandfehler -> 502, eine Protokollzeile
- Falsifizierungen (a)-(d) als Specs; @Expose() im DTO, damit errors auch bei fehlendem Feld zu [] wird
- Doku-Zeile fuer rls-access-inventory, TESSERA_BUGREPORT_TO in docker-compose.prod.yml

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018N9CD3ebPKm1b32bPpBknY
2026-09-14 16:45:09 +02:00

63 lines
1.4 KiB
TypeScript

import {
IsEmail,
IsIn,
IsInt,
IsNotEmpty,
IsOptional,
IsString,
Max,
Min,
} from 'class-validator';
/**
* DTO for saving or testing an SMTP configuration.
*
* Security: T-07-08 — host/port/encryption validated to prevent open-relay abuse.
* Password field is optional on PUT (empty string = preserve existing stored password).
*/
export class SmtpConfigDto {
@IsString()
@IsNotEmpty()
host!: string;
@IsInt()
@Min(1)
@Max(65535)
port!: number;
/** 'none' | 'starttls' | 'ssl-tls' */
@IsIn(['none', 'starttls', 'ssl-tls'])
encryption!: string;
@IsOptional()
@IsString()
username?: string;
/**
* Plaintext password submitted by the client.
* Empty string means "keep existing stored password" on PUT.
* Never returned in GET responses.
*/
@IsOptional()
@IsString()
password?: string;
@IsEmail()
fromAddress!: string;
@IsOptional()
@IsEmail()
testTo?: string;
/**
* Postfach fuer den Fehler-melden-Knopf (quick-260914-m97). Optional:
* fehlt das Feld im PUT, bleibt der gespeicherte Wert; `null` loescht ihn.
* Absicht (T-M97-05): nur ein Administrator dieses Mandanten kann das
* Ziel aller Fehlermeldungen seines Mandanten setzen — der Weg fuehrt
* ausschliesslich ueber `PUT /settings/smtp` mit `@Roles(ADMIN, SUPER_ADMIN)`.
*/
@IsOptional()
@IsEmail()
bugReportRecipient?: string | null;
}