-
Notifications
You must be signed in to change notification settings - Fork 1
fix #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #68
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 }) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To maintain consistency with the suggested change in the
Suggested change
|
||||||
| experience?: RangeObject; | ||||||
|
|
||||||
| @ArrayMinSize(1) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,9 +20,9 @@ function __IsRange(validationOptions?: ValidationOptions) { | |||||
|
|
||||||
| export function IsRange (options?: ValidationOptions) { | ||||||
| return applyDecorators( | ||||||
| Matches(/^(\d+)-(\d+)$/), | ||||||
| Matches(/^(\d+),(\d+)$/), | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| Transform(({ value }) => | ||||||
| value && value.split('-') | ||||||
| value && value.split(',') | ||||||
| .map(s => Number(s.trim())) | ||||||
| ), | ||||||
| __IsRange(options), | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain consistency with the suggested change in the
IsRangedecorator's validation regex, thisApiPropertypattern should also be updated to allow for optional whitespace around the comma. This ensures the API documentation accurately reflects the validation logic.