import { IsBoolean, IsHexColor, IsIn, IsNotEmpty, IsOptional, IsString, IsUrl, } from 'class-validator'; /** * DTO for creating a new calendar source. * * Security: * - T-05-11: URL restricted to https only (SSRF mitigation) * - T-05-10: password is plaintext in transit (over TLS), encrypted at rest by CryptoService */ export class CreateCalendarSourceDto { @IsString() @IsNotEmpty() name!: string; @IsIn(['caldav', 'ics', 'exchange']) type!: string; @IsUrl( { protocols: ['https'], require_protocol: true }, { message: 'URL must use HTTPS protocol' }, ) url!: string; @IsOptional() @IsString() username?: string; @IsOptional() @IsString() password?: string; @IsOptional() @IsIn(['ews', 'graph']) exchangeMode?: string; @IsOptional() @IsHexColor() color?: string; }