From 0243e78feabc5ef02f64921e7ef72b266023f5f3 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Fri, 31 Jul 2026 10:45:03 +0000 Subject: [PATCH] feat(opportunities): add dto --- src/opportunities/dto.ts | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/opportunities/dto.ts diff --git a/src/opportunities/dto.ts b/src/opportunities/dto.ts new file mode 100644 index 0000000..35d4e34 --- /dev/null +++ b/src/opportunities/dto.ts @@ -0,0 +1,69 @@ +import { IsISO8601, IsNumber, IsOptional, IsString, Length, Max, Min } from 'class-validator'; + +export class CreateOpportunityDto { + @IsString() + @Length(1, 128) + source!: string; + + @IsOptional() + @IsString() + @Length(1, 64) + entityType?: string; + + @IsOptional() + @IsString() + @Length(1, 255) + entityId?: string; + + @IsOptional() + @IsNumber() + @Min(0) + valueRangeMin?: number; + + @IsOptional() + @IsNumber() + @Min(0) + valueRangeMax?: number; + + @IsOptional() + @IsNumber() + @Min(0) + @Max(1) + probability?: number; + + @IsOptional() + @IsString() + @Length(1, 500) + nextAction?: string; + + @IsOptional() + @IsISO8601() + expiresAt?: string; +} + +export class UpdateOpportunityDto { + @IsOptional() + @IsNumber() + @Min(0) + @Max(1) + probability?: number; + + @IsOptional() + @IsString() + @Length(1, 500) + nextAction?: string; + + @IsOptional() + @IsISO8601() + expiresAt?: string; + + @IsOptional() + @IsNumber() + @Min(0) + valueRangeMin?: number; + + @IsOptional() + @IsNumber() + @Min(0) + valueRangeMax?: number; +}