Some checks failed
ci/woodpecker/push/ci Pipeline failed
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { ProjectStatus } from "@prisma/client";
|
|
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsEnum,
|
|
IsDateString,
|
|
IsObject,
|
|
MinLength,
|
|
MaxLength,
|
|
Matches,
|
|
IsUUID,
|
|
} from "class-validator";
|
|
|
|
/**
|
|
* DTO for updating an existing project
|
|
* All fields are optional to support partial updates
|
|
*/
|
|
export class UpdateProjectDto {
|
|
@IsOptional()
|
|
@IsString({ message: "name must be a string" })
|
|
@MinLength(1, { message: "name must not be empty" })
|
|
@MaxLength(255, { message: "name must not exceed 255 characters" })
|
|
name?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "description must be a string" })
|
|
@MaxLength(10000, { message: "description must not exceed 10000 characters" })
|
|
description?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsEnum(ProjectStatus, { message: "status must be a valid ProjectStatus" })
|
|
status?: ProjectStatus;
|
|
|
|
@IsOptional()
|
|
@IsDateString({}, { message: "startDate must be a valid ISO 8601 date string" })
|
|
startDate?: Date | null;
|
|
|
|
@IsOptional()
|
|
@IsDateString({}, { message: "endDate must be a valid ISO 8601 date string" })
|
|
endDate?: Date | null;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "color must be a string" })
|
|
@Matches(/^#[0-9A-F]{6}$/i, {
|
|
message: "color must be a valid hex color code (e.g., #FF5733)",
|
|
})
|
|
color?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsUUID("4", { message: "domainId must be a valid UUID" })
|
|
domainId?: string | null;
|
|
|
|
@IsOptional()
|
|
@IsObject({ message: "metadata must be an object" })
|
|
metadata?: Record<string, unknown>;
|
|
}
|