process/insurance: add fingap.policyType validation

This commit is contained in:
vchikalkin 2023-06-08 16:45:05 +03:00
parent b90bfc74d9
commit 0952ce12ee

View File

@ -1,3 +1,4 @@
/* eslint-disable complexity */
/* eslint-disable sonarjs/cognitive-complexity */
/* eslint-disable zod/require-strict */
import type { ValidationContext } from '../types';
@ -109,6 +110,14 @@ export function createValidationSchema({ apolloClient }: ValidationContext) {
});
}
if (fingap.insuranceCompany && !fingap.insTerm) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Укажите срок страхования ${fingap.policyType}`,
path: ['insurance'],
});
}
if (
!leasingWithoutKasko &&
!insDecentral &&