import { ArrayMaxSize, ArrayUnique, IsArray, IsString, IsUUID, ValidateIf, } from 'class-validator'; import { CodePointLength } from '../../common/validation/code-point-length.js'; export class CreateMessageDto { @IsString() @CodePointLength(0, 4000) text!: string; // Absent means []; null is a client error. @ValidateIf((_, value) => value !== undefined) @IsArray() @ArrayMaxSize(10) @ArrayUnique() @IsUUID('all', { each: true }) attachment_ids: string[] = []; }