159 lines
2.3 KiB
TypeScript
159 lines
2.3 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
IsInt,
|
|
IsNotEmpty,
|
|
IsObject,
|
|
IsOptional,
|
|
IsString,
|
|
MaxLength,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
export class WhatsappMediaDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
data: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MaxLength(160)
|
|
mimetype: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(260)
|
|
filename?: string;
|
|
}
|
|
|
|
export class SendWhatsappMessageDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
to: string;
|
|
|
|
@IsString()
|
|
message: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(120)
|
|
senderName?: string;
|
|
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => WhatsappMediaDto)
|
|
media?: WhatsappMediaDto;
|
|
}
|
|
|
|
export class StartAttendanceDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
to: string;
|
|
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
templateId: number;
|
|
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
userId: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
areaId?: number | null;
|
|
|
|
@IsOptional()
|
|
@IsObject()
|
|
variables?: Record<string, string | null | undefined>;
|
|
}
|
|
|
|
export class AssignChatDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
chatId: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
userId: string;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
areaId?: number | null;
|
|
}
|
|
|
|
export class TransferChatDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
chatId: string;
|
|
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
areaId: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
userId?: number | null;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
note?: string | null;
|
|
}
|
|
|
|
export class CloseChatDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
chatId: string;
|
|
|
|
@IsOptional()
|
|
userId?: string | number | null;
|
|
}
|
|
|
|
export class CreateWhatsappTemplateDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MaxLength(255)
|
|
name: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
content: string;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
areaId?: number | null;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(40)
|
|
requestedByRole?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(40)
|
|
category?: string;
|
|
}
|
|
|
|
export class UpdateWhatsappTemplateDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MaxLength(255)
|
|
name: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
content: string;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
areaId?: number | null;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(40)
|
|
category?: string;
|
|
}
|