import { Transform } from 'class-transformer'; import { IsEnum, IsOptional, IsString, Matches, MaxLength } from 'class-validator'; import { InspectionReportFollowUpType } from '../../database/entities'; export class CreateInspectionReportFollowUpDto { @IsEnum(InspectionReportFollowUpType) eventType!: InspectionReportFollowUpType; @IsOptional() @Transform(({ value }) => (typeof value === 'string' && value.trim() ? value.trim() : null)) @IsString() @MaxLength(255) referenceNumber?: string | null; @Matches(/^\d{4}-\d{2}-\d{2}$/) occurredOn!: string; @IsOptional() @Transform(({ value }) => (typeof value === 'string' && value.trim() ? value.trim() : null)) @IsString() @MaxLength(20000) description?: string | null; }