Skip to content

Commit

Permalink
FIO-8037: moved validateNumberInfo to clientRules and resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrinKhilko committed Apr 18, 2024
1 parent 01f0e40 commit b091294
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/process/validation/rules/clientRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { validateRequiredDayInfo } from "./validateRequiredDay";
import { validateTimeInfo } from "./validateTime";
import { validateUrlInfo } from "./validateUrl";
import { validateValuePropertyInfo } from "./validateValueProperty";
import { validateNumberInfo } from "./validateNumber";

// These are the validations that are performed in the client.
export const clientRules: ValidationRuleInfo[] = [
Expand All @@ -49,5 +50,6 @@ export const clientRules: ValidationRuleInfo[] = [
validateRequiredDayInfo,
validateTimeInfo,
validateUrlInfo,
validateValuePropertyInfo
validateValuePropertyInfo,
validateNumberInfo
];
4 changes: 1 addition & 3 deletions src/process/validation/rules/databaseRules.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ValidationRuleInfo } from "types";
import { validateUniqueInfo } from "./validateUnique";
import { validateCaptchaInfo } from "./validateCaptcha";
import { validateNumberInfo } from "./validateNumber";

// These are the validations that require a database connection.
export const databaseRules: ValidationRuleInfo[] = [
validateUniqueInfo,
validateCaptchaInfo,
validateNumberInfo
validateCaptchaInfo
];
5 changes: 1 addition & 4 deletions src/process/validation/rules/validateNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ export const validateNumber: RuleFn = async (context: ValidationContext) => {
export const validateNumberSync: RuleFnSync = (context: ValidationContext) => {
const error = new FieldError('number', context);
const { value } = context;
if (!shouldValidate(context)) {
return null;
}


if (typeof value !== 'number') {
return error;
}
Expand Down

0 comments on commit b091294

Please sign in to comment.