70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import { TaskStatus, TaskPriority } from "@prisma/client";
|
|
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsUUID,
|
|
IsEnum,
|
|
IsDateString,
|
|
IsInt,
|
|
IsObject,
|
|
MinLength,
|
|
MaxLength,
|
|
Min,
|
|
} from "class-validator";
|
|
|
|
/**
|
|
* DTO for updating an existing task
|
|
* All fields are optional to support partial updates
|
|
*/
|
|
export class UpdateTaskDto {
|
|
@IsOptional()
|
|
@IsString({ message: "title must be a string" })
|
|
@MinLength(1, { message: "title must not be empty" })
|
|
@MaxLength(255, { message: "title must not exceed 255 characters" })
|
|
title?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "description must be a string" })
|
|
@MaxLength(10000, { message: "description must not exceed 10000 characters" })
|
|
description?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsEnum(TaskStatus, { message: "status must be a valid TaskStatus" })
|
|
status?: TaskStatus;
|
|
|
|
@IsOptional()
|
|
@IsEnum(TaskPriority, { message: "priority must be a valid TaskPriority" })
|
|
priority?: TaskPriority;
|
|
|
|
@IsOptional()
|
|
@IsDateString({}, { message: "dueDate must be a valid ISO 8601 date string" })
|
|
dueDate?: Date | null;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "assigneeId must be a valid UUID" })
|
|
assigneeId?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "projectId must be a valid UUID" })
|
|
projectId?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "parentId must be a valid UUID" })
|
|
parentId?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "assignedAgent must be a string" })
|
|
@MinLength(1, { message: "assignedAgent must not be empty" })
|
|
@MaxLength(255, { message: "assignedAgent must not exceed 255 characters" })
|
|
assignedAgent?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsInt({ message: "sortOrder must be an integer" })
|
|
@Min(0, { message: "sortOrder must be at least 0" })
|
|
sortOrder?: number;
|
|
|
|
@IsOptional()
|
|
@IsObject({ message: "metadata must be an object" })
|
|
metadata?: Record<string, unknown>;
|
|
}
|