Files
CRM_Montzar/apps/api/src/conversations/dto.ts
T

105 lines
1.7 KiB
TypeScript
Raw Normal View History

import {
IsArray,
IsBoolean,
IsOptional,
IsString,
MaxLength,
MinLength,
ArrayMinSize,
ArrayMaxSize,
} from 'class-validator';
export class UpdateConversationSettingsDto {
@IsString()
@MinLength(3)
@MaxLength(200)
chatHost!: string;
@IsOptional()
@IsString()
@MinLength(8)
@MaxLength(500)
apiKey?: string;
@IsOptional()
@IsString()
@MaxLength(500)
uploadUrl?: string;
@IsOptional()
@IsString()
@MaxLength(500)
downloadUrl?: string;
}
export class CreateConversationDmDto {
@IsString()
@MinLength(1)
peerUserId!: string;
}
export class CreateConversationGroupDto {
@IsString()
@MinLength(2)
@MaxLength(120)
name!: string;
@IsArray()
@ArrayMinSize(1)
@ArrayMaxSize(50)
@IsString({ each: true })
memberUserIds!: string[];
}
export class HideConversationMessagesDto {
@IsString()
@MinLength(1)
@MaxLength(200)
externalRoomId!: string;
@IsArray()
@ArrayMinSize(1)
@ArrayMaxSize(100)
@IsString({ each: true })
messageIds!: string[];
/** true = حذف برای همه؛ false = فقط برای کاربر جاری */
@IsOptional()
@IsBoolean()
forEveryone?: boolean;
}
export class PinConversationMessageDto {
@IsString()
@MinLength(1)
@MaxLength(200)
externalRoomId!: string;
@IsString()
@MinLength(1)
@MaxLength(200)
messageId!: string;
@IsOptional()
@IsString()
@MaxLength(240)
preview?: string;
}
export class UnpinConversationMessageDto {
@IsString()
@MinLength(1)
@MaxLength(200)
externalRoomId!: string;
}
export class PinConversationRoomDto {
@IsString()
@MinLength(1)
@MaxLength(200)
externalRoomId!: string;
@IsBoolean()
pinned!: boolean;
}