feat(goals): add dto
This commit is contained in:
parent
a3b29e6cc2
commit
9d9870877e
1 changed files with 47 additions and 0 deletions
47
src/goals/dto.ts
Normal file
47
src/goals/dto.ts
Normal 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;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue