fix(opportunities): enforce @IsInt() on valueRangeMin/Max to prevent float input
This commit is contained in:
parent
6c44c327cf
commit
0e016edec2
1 changed files with 7 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue