From 9d9870877e2cf80490c7480721fca2900dbc3856 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Fri, 31 Jul 2026 10:44:50 +0000 Subject: [PATCH] feat(goals): add dto --- src/goals/dto.ts | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/goals/dto.ts diff --git a/src/goals/dto.ts b/src/goals/dto.ts new file mode 100644 index 0000000..01c65e3 --- /dev/null +++ b/src/goals/dto.ts @@ -0,0 +1,47 @@ +import { IsArray, IsIn, IsOptional, IsString, Length } from 'class-validator'; + +export const GOAL_STATUSES = ['not_started', 'on_track', 'at_risk', 'achieved', 'abandoned'] as const; +export type GoalStatusValue = (typeof GOAL_STATUSES)[number]; + +export class CreateGoalDto { + @IsString() + @Length(1, 500) + horizon!: string; + + @IsString() + @Length(1, 500) + metric!: string; + + @IsString() + @Length(1, 1000) + target!: string; + + @IsOptional() + @IsArray() + milestones?: unknown[]; +} + +export class UpdateGoalDto { + @IsOptional() + @IsString() + @Length(1, 500) + horizon?: string; + + @IsOptional() + @IsString() + @Length(1, 500) + metric?: string; + + @IsOptional() + @IsString() + @Length(1, 1000) + target?: string; + + @IsOptional() + @IsArray() + milestones?: unknown[]; + + @IsOptional() + @IsIn(GOAL_STATUSES as unknown as string[]) + status?: GoalStatusValue; +}