This commit is contained in:
2026-01-10 15:02:13 +03:30
parent 7cc6464f31
commit aa23bf5614
14 changed files with 1177 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
import { ApiProperty } from "@nestjs/swagger";
import { ArrayMinSize, IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID, IsUrl, Length } from "class-validator";
import { TicketMessageEnum, UserMessage } from "../../../common/enums/message.enum";
import { TicketPriority } from "../enums/ticket-priority.enum";
export class CreateTicketDto {
// @IsNotEmpty({ message: TicketMessageEnum.TITLE_REQUIRED })
// @IsString({ message: TicketMessageEnum.TITLE_STRING })
// @Length(3, 150, { message: TicketMessageEnum.TITLE_LENGTH })
// @ApiProperty({ description: "The ticket title", example: "Test title" })
// title: string;
@IsNotEmpty({ message: TicketMessageEnum.SUBJECT_REQUIRED })
@IsString({ message: TicketMessageEnum.SUBJECT_STRING })
@Length(3, 150, { message: TicketMessageEnum.SUBJECT_LENGTH })
@ApiProperty({ description: "Subject of the ticket", example: "Subject" })
subject: string;
@IsNotEmpty({ message: TicketMessageEnum.PRIORITY_REQUIRED })
@IsEnum(TicketPriority, { message: TicketMessageEnum.PRIORITY_INVALID })
@ApiProperty({ enum: TicketPriority, example: TicketPriority.LOW, description: "LOW, MEDIUM, HIGH" })
priority: TicketPriority;
@IsOptional()
@IsNotEmpty({ message: TicketMessageEnum.DANAK_SERVICE_ID_REQUIRED })
@IsUUID("4", { message: TicketMessageEnum.DANAK_SERVICE_ID_SHOULD_BE_UUID })
@ApiProperty({ description: "Service ID related to the ticket", example: "550e8400-e29b-41d4-a716-446655440000" })
danakServiceId?: string;
@IsNotEmpty({ message: TicketMessageEnum.CATEGORY_ID_REQUIRED })
@IsUUID("4", { message: TicketMessageEnum.CATEGORY_ID_SHOULD_BE_UUID })
@ApiProperty({ description: "Category ID of the ticket", example: "123e4567-e89b-12d3-a456-426614174000" })
categoryId: string;
@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", example: "This is a detailed description of the issue." })
message: string;
@IsOptional()
@IsNotEmpty({ message: TicketMessageEnum.ATTACHMENT_REQUIRED })
@ArrayMinSize(1, { message: TicketMessageEnum.ATTACHMENT_REQUIRED })
@IsUrl({ protocols: ["http", "https"], require_protocol: true }, { each: true, message: TicketMessageEnum.ATTACHMENT_SHOULD_BE_URL })
@ApiProperty({ description: "attachment url", example: ["https://example.com/test.png"] })
attachmentUrls?: string[];
}
export class CreateTicketByAdminDto extends CreateTicketDto {
@IsNotEmpty({ message: UserMessage.USER_ID_REQUIRED })
@IsUUID("4", { message: UserMessage.USER_ID_SHOULD_BE_A_UUID })
@ApiProperty({ description: "User ID of the ticket", example: "123e4567-e89b-12d3-a456-426614174000" })
userId: string;
}