diff --git a/src/users/api/search.adjacent.users.query.ts b/src/users/api/search.adjacent.users.query.ts index 2fd07f1..7b90af5 100644 --- a/src/users/api/search.adjacent.users.query.ts +++ b/src/users/api/search.adjacent.users.query.ts @@ -8,6 +8,6 @@ export class SearchAdjacentUsersQuery extends OmitType( ) { @IsRange() @IsOptional() - @ApiProperty({ name: "age", type: "string", pattern: "^(\\d)-(\\d)$", required: false }) + @ApiProperty({ name: "age", type: "string", pattern: "^(\\d+),(\\d+)$", required: false }) age?: [number, number]; } \ No newline at end of file diff --git a/src/users/dto/search.users.filters.ts b/src/users/dto/search.users.filters.ts index 73f09a5..e79eb42 100644 --- a/src/users/dto/search.users.filters.ts +++ b/src/users/dto/search.users.filters.ts @@ -11,7 +11,7 @@ export class SearchUsersFilters { @IsNumber({}, { each: true }) @IsRange() @IsOptional() - @ApiProperty({ type: "string", pattern: "^(\\d)-(\\d)$", required: false }) + @ApiProperty({ type: "string", pattern: "^(\\d+),(\\d+)$", required: false }) experience?: RangeObject; @ArrayMinSize(1) diff --git a/src/utils/decorator/is-range.ts b/src/utils/decorator/is-range.ts index 88bb860..fa1ccd9 100644 --- a/src/utils/decorator/is-range.ts +++ b/src/utils/decorator/is-range.ts @@ -20,9 +20,9 @@ function __IsRange(validationOptions?: ValidationOptions) { export function IsRange (options?: ValidationOptions) { return applyDecorators( - Matches(/^(\d+)-(\d+)$/), + Matches(/^(\d+),(\d+)$/), Transform(({ value }) => - value && value.split('-') + value && value.split(',') .map(s => Number(s.trim())) ), __IsRange(options),