fix: disallow zero as a value in some fields
This commit is contained in:
parent
170bc8b1c9
commit
c346f0b8e4
1 changed files with 8 additions and 8 deletions
|
|
@ -104,7 +104,7 @@ const requirement = Yup.object().shape({
|
||||||
is: 'suspend',
|
is: 'suspend',
|
||||||
then: Yup.number()
|
then: Yup.number()
|
||||||
.required()
|
.required()
|
||||||
.min(0)
|
.min(1)
|
||||||
.label('Invalid value'),
|
.label('Invalid value'),
|
||||||
otherwise: Yup.number()
|
otherwise: Yup.number()
|
||||||
.nullable()
|
.nullable()
|
||||||
|
|
@ -126,10 +126,10 @@ const Schema = Yup.object()
|
||||||
const validator = {
|
const validator = {
|
||||||
txAmount: threshold => threshold.threshold >= 0,
|
txAmount: threshold => threshold.threshold >= 0,
|
||||||
txVolume: threshold =>
|
txVolume: threshold =>
|
||||||
threshold.threshold >= 0 && threshold.thresholdDays >= 0,
|
threshold.threshold >= 0 && threshold.thresholdDays > 0,
|
||||||
txVelocity: threshold =>
|
txVelocity: threshold =>
|
||||||
threshold.threshold >= 0 && threshold.thresholdDays >= 0,
|
threshold.threshold > 0 && threshold.thresholdDays > 0,
|
||||||
consecutiveDays: threshold => threshold.thresholdDays >= 0
|
consecutiveDays: threshold => threshold.thresholdDays > 0
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
(triggerType && validator?.[triggerType](threshold)) ||
|
(triggerType && validator?.[triggerType](threshold)) ||
|
||||||
|
|
@ -244,10 +244,10 @@ const typeSchema = Yup.object()
|
||||||
const validator = {
|
const validator = {
|
||||||
txAmount: threshold => threshold.threshold >= 0,
|
txAmount: threshold => threshold.threshold >= 0,
|
||||||
txVolume: threshold =>
|
txVolume: threshold =>
|
||||||
threshold.threshold >= 0 && threshold.thresholdDays >= 0,
|
threshold.threshold >= 0 && threshold.thresholdDays > 0,
|
||||||
txVelocity: threshold =>
|
txVelocity: threshold =>
|
||||||
threshold.threshold >= 0 && threshold.thresholdDays >= 0,
|
threshold.threshold > 0 && threshold.thresholdDays > 0,
|
||||||
consecutiveDays: threshold => threshold.thresholdDays >= 0
|
consecutiveDays: threshold => threshold.thresholdDays > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -397,7 +397,7 @@ const requirementSchema = Yup.object().shape({
|
||||||
is: value => value === 'suspend',
|
is: value => value === 'suspend',
|
||||||
then: Yup.number()
|
then: Yup.number()
|
||||||
.required()
|
.required()
|
||||||
.min(0),
|
.min(1),
|
||||||
otherwise: Yup.number()
|
otherwise: Yup.number()
|
||||||
.nullable()
|
.nullable()
|
||||||
.transform(() => null)
|
.transform(() => null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue