import { ArrayMaxSize, IsArray, IsOptional, IsString, MaxLength, ValidateNested, } from 'class-validator'; import { Type } from 'class-transformer'; class AttachmentDto { @IsString() @MaxLength(2048) url!: string; @IsOptional() @IsString() @MaxLength(255) name?: string; @IsOptional() @IsString() @MaxLength(100) mimeType?: string; } export class CreateMessageDto { @IsString() @MaxLength(4000) content!: string; @IsOptional() @IsString() @MaxLength(80) clientMessageId?: string; @IsOptional() @IsString() @MaxLength(80) replyToMessageId?: string; @IsOptional() @IsArray() @ArrayMaxSize(50) @IsString({ each: true }) mentions?: string[]; @IsOptional() @IsArray() @ArrayMaxSize(10) @ValidateNested({ each: true }) @Type(() => AttachmentDto) attachments?: AttachmentDto[]; @IsOptional() @IsString() @MaxLength(64) authorUserId?: string; }