From 3ad73a5271e12361b255ce24256cc9e16aef2088 Mon Sep 17 00:00:00 2001 From: realrafi Date: Thu, 2 Jul 2026 12:11:44 +0330 Subject: [PATCH] feat: added attachment DTOs --- .../dto/attachment/create-attachment.dto.ts | 26 +++++++++++++++++++ .../dto/attachment/update-attachment.dto.ts | 4 +++ 2 files changed, 30 insertions(+) create mode 100644 src/modules/task-manager/dto/attachment/create-attachment.dto.ts create mode 100644 src/modules/task-manager/dto/attachment/update-attachment.dto.ts diff --git a/src/modules/task-manager/dto/attachment/create-attachment.dto.ts b/src/modules/task-manager/dto/attachment/create-attachment.dto.ts new file mode 100644 index 0000000..dcca8d4 --- /dev/null +++ b/src/modules/task-manager/dto/attachment/create-attachment.dto.ts @@ -0,0 +1,26 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { IsString, IsNotEmpty, IsUUID, IsEnum, MaxLength } from "class-validator"; +import { TMAttachmentType } from "../../enums/attachment-type.enum"; + +export class CreateAttachmentDto { + @ApiProperty({ description: "Title of the attachment", example: "Project Requirements Doc" }) + @IsString() + @IsNotEmpty() + @MaxLength(150) + title: string; + + @ApiProperty({ description: "Type of the attachment", enum: TMAttachmentType, example: TMAttachmentType.FILE }) + @IsEnum(TMAttachmentType) + @IsNotEmpty() + type: TMAttachmentType; + + @ApiProperty({ description: "File URL or path of the attachment", example: "https://cdn.example.com/files/requirements.pdf" }) + @IsString() + @IsNotEmpty() + file: string; + + @ApiProperty({ description: "ID of the task this attachment belongs to", example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }) + @IsUUID() + @IsNotEmpty() + taskId: string; +} diff --git a/src/modules/task-manager/dto/attachment/update-attachment.dto.ts b/src/modules/task-manager/dto/attachment/update-attachment.dto.ts new file mode 100644 index 0000000..977fed9 --- /dev/null +++ b/src/modules/task-manager/dto/attachment/update-attachment.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from "@nestjs/swagger"; +import { CreateAttachmentDto } from "./create-attachment.dto"; + +export class UpdateAttachmentDto extends PartialType(CreateAttachmentDto) {}