import { ApiPropertyOptional } from '@nestjs/swagger'; import { IsOptional, IsUrl, MaxLength, ValidateIf } from 'class-validator'; // An empty string clears the link (stored as null); anything else must be a // real URL - ValidateIf skips the @IsUrl check only for the empty-string // "clear" case so a genuinely malformed value still fails validation. export class UpdateSiteSettingsDto { @ApiPropertyOptional({ description: 'Leerer String löscht den Link' }) @IsOptional() @ValidateIf((_, value: string) => value !== '') @IsUrl({ require_protocol: true }) @MaxLength(300) youtubeUrl?: string; @ApiPropertyOptional({ description: 'Leerer String löscht den Link' }) @IsOptional() @ValidateIf((_, value: string) => value !== '') @IsUrl({ require_protocol: true }) @MaxLength(300) instagramUrl?: string; @ApiPropertyOptional({ description: 'Leerer String löscht den Link' }) @IsOptional() @ValidateIf((_, value: string) => value !== '') @IsUrl({ require_protocol: true }) @MaxLength(300) tiktokUrl?: string; }