Files
backend/src/messages/dto/create-message.dto.ts

36 lines
1020 B
TypeScript
Raw Normal View History

import { IsString, IsNotEmpty, IsOptional, IsEnum, MaxLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { MessageType } from '@prisma/client';
export class CreateMessageDto {
@ApiProperty({ description: 'Message content', maxLength: 5000 })
@IsString()
@IsNotEmpty()
@MaxLength(5000)
content: string;
@ApiPropertyOptional({ description: 'Message type', enum: MessageType, default: MessageType.TEXT })
@IsOptional()
@IsEnum(MessageType)
messageType?: MessageType = MessageType.TEXT;
@ApiPropertyOptional({ description: 'File URL for file/image messages' })
@IsOptional()
@IsString()
fileUrl?: string;
@ApiPropertyOptional({ description: 'Original file name' })
@IsOptional()
@IsString()
fileName?: string;
@ApiPropertyOptional({ description: 'File size in bytes' })
@IsOptional()
fileSize?: number;
@ApiPropertyOptional({ description: 'MIME type of the file' })
@IsOptional()
@IsString()
mimeType?: string;
}