54 lines
989 B
TypeScript
54 lines
989 B
TypeScript
import { IsOptional, IsString, IsNotEmpty, IsArray, ValidateNested } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class DeviceInfoDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
ip?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
userAgent?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
fingerprint?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
region?: string;
|
|
}
|
|
|
|
export class CreateConversationDto {
|
|
@IsOptional()
|
|
@IsString()
|
|
title?: string;
|
|
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => DeviceInfoDto)
|
|
deviceInfo?: DeviceInfoDto;
|
|
}
|
|
|
|
export class FileAttachmentDto {
|
|
id: string;
|
|
originalName: string;
|
|
mimeType: string;
|
|
type: 'image' | 'document' | 'audio' | 'video' | 'other';
|
|
size: number;
|
|
downloadUrl?: string;
|
|
thumbnailUrl?: string;
|
|
}
|
|
|
|
export class SendMessageDto {
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
content: string;
|
|
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => FileAttachmentDto)
|
|
attachments?: FileAttachmentDto[];
|
|
}
|