Files
negareh-api/src/modules/ticket/DTO/create-ticket.dto.ts
T
2026-01-28 11:11:20 +03:30

21 lines
906 B
TypeScript
Executable File

import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty, IsOptional, IsString, IsUrl, Length } from "class-validator";
import { AttachmentType } from "../interfaces/ticket";
import { TicketMessageEnum } from "../../../common/enums/message.enum";
export class CreateTicketDto {
@IsNotEmpty({ message: TicketMessageEnum.MESSAGE_REQUIRED })
@IsString({ message: TicketMessageEnum.MESSAGE_STRING })
@Length(5, 5000, { message: TicketMessageEnum.MESSAGE_LENGTH })
@ApiProperty({ description: "The message content of the ticket" })
content: string;
@IsOptional()
@IsNotEmpty({ message: TicketMessageEnum.ATTACHMENT_REQUIRED })
@IsUrl({ protocols: ["http", "https"], require_protocol: true }, { each: true, message: TicketMessageEnum.ATTACHMENT_SHOULD_BE_URL })
@ApiProperty({ description: "attachment url", example: [{ type: '', url: '' }] })
attachments?: AttachmentType[];
}