From 0e016edec250d327f493dc0ded2a6a30f7153689 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Fri, 31 Jul 2026 10:48:40 +0000 Subject: [PATCH] fix(opportunities): enforce @IsInt() on valueRangeMin/Max to prevent float input --- src/opportunities/dto.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/opportunities/dto.ts b/src/opportunities/dto.ts index 35d4e34..5670aa6 100644 --- a/src/opportunities/dto.ts +++ b/src/opportunities/dto.ts @@ -1,4 +1,4 @@ -import { IsISO8601, IsNumber, IsOptional, IsString, Length, Max, Min } from 'class-validator'; +import { IsISO8601, IsInt, IsNumber, IsOptional, IsString, Length, Max, Min } from 'class-validator'; export class CreateOpportunityDto { @IsString() @@ -15,13 +15,15 @@ export class CreateOpportunityDto { @Length(1, 255) entityId?: string; + /** Valoarea minima estimata in minor units (ex: eurocenti). Trebuie sa fie integer. */ @IsOptional() - @IsNumber() + @IsInt() @Min(0) valueRangeMin?: number; + /** Valoarea maxima estimata in minor units. Trebuie sa fie integer. */ @IsOptional() - @IsNumber() + @IsInt() @Min(0) valueRangeMax?: number; @@ -58,12 +60,12 @@ export class UpdateOpportunityDto { expiresAt?: string; @IsOptional() - @IsNumber() + @IsInt() @Min(0) valueRangeMin?: number; @IsOptional() - @IsNumber() + @IsInt() @Min(0) valueRangeMax?: number; }