feat(goals): add dto

This commit is contained in:
admin-valentin 2026-07-31 10:44:50 +00:00
parent a3b29e6cc2
commit 9d9870877e

47
src/goals/dto.ts Normal file
View file

@ -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;
}