From 7f02534a7f463c87622ab3aced18ed56fe110648 Mon Sep 17 00:00:00 2001 From: hoseok Date: Mon, 11 Aug 2025 10:26:00 +0900 Subject: [PATCH] fix --- src/users/api/search.adjacent.users.query.ts | 2 +- src/users/dto/search.users.filters.ts | 2 +- src/utils/decorator/is-range.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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),