Fix vendors validation

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-11-06 18:05:21 +01:00
parent eb0ce9281d
commit a63705619a
2 changed files with 34 additions and 34 deletions

View File

@@ -11,18 +11,18 @@ const schema = z.object({
name: z.string().min(1, "Name is required"), name: z.string().min(1, "Name is required"),
description: z.string().optional().nullable(), description: z.string().optional().nullable(),
category: z.string().nullish(), category: z.string().nullish(),
statusPageUrl: z.string().optional(), statusPageUrl: z.string().optional().nullable(),
termsOfServiceUrl: z.string().optional(), termsOfServiceUrl: z.string().optional().nullable(),
privacyPolicyUrl: z.string().optional(), privacyPolicyUrl: z.string().optional().nullable(),
serviceLevelAgreementUrl: z.string().optional(), serviceLevelAgreementUrl: z.string().optional().nullable(),
dataProcessingAgreementUrl: z.string().optional(), dataProcessingAgreementUrl: z.string().optional().nullable(),
websiteUrl: z.string().optional(), websiteUrl: z.string().optional().nullable(),
legalName: z.string().optional(), legalName: z.string().optional().nullable(),
headquarterAddress: z.string().optional(), headquarterAddress: z.string().optional().nullable(),
certifications: z.array(z.string()), certifications: z.array(z.string()),
countries: z.array(z.string()), countries: z.array(z.string()),
securityPageUrl: z.string().optional(), securityPageUrl: z.string().optional().nullable(),
trustPageUrl: z.string().optional(), trustPageUrl: z.string().optional().nullable(),
businessOwnerId: z.string().nullish(), businessOwnerId: z.string().nullish(),
securityOwnerId: z.string().nullish(), securityOwnerId: z.string().nullish(),
}); });
@@ -76,20 +76,20 @@ export function useVendorForm(vendorKey: useVendorFormFragment$key) {
const defaultValues = useMemo( const defaultValues = useMemo(
() => ({ () => ({
name: vendor.name, name: vendor.name,
description: vendor.description ?? "", description: vendor.description || null,
category: vendor.category ?? null, category: vendor.category || null,
statusPageUrl: vendor.statusPageUrl ?? "", statusPageUrl: vendor.statusPageUrl || null,
termsOfServiceUrl: vendor.termsOfServiceUrl ?? "", termsOfServiceUrl: vendor.termsOfServiceUrl || null,
privacyPolicyUrl: vendor.privacyPolicyUrl ?? "", privacyPolicyUrl: vendor.privacyPolicyUrl || null,
serviceLevelAgreementUrl: vendor.serviceLevelAgreementUrl ?? "", serviceLevelAgreementUrl: vendor.serviceLevelAgreementUrl || null,
dataProcessingAgreementUrl: vendor.dataProcessingAgreementUrl ?? "", dataProcessingAgreementUrl: vendor.dataProcessingAgreementUrl || null,
websiteUrl: vendor.websiteUrl ?? "", websiteUrl: vendor.websiteUrl || null,
legalName: vendor.legalName ?? "", legalName: vendor.legalName || null,
headquarterAddress: vendor.headquarterAddress ?? "", headquarterAddress: vendor.headquarterAddress || null,
certifications: [...(vendor.certifications ?? [])], certifications: [...(vendor.certifications ?? [])],
countries: [...(vendor.countries ?? [])], countries: [...(vendor.countries ?? [])],
securityPageUrl: vendor.securityPageUrl ?? "", securityPageUrl: vendor.securityPageUrl || null,
trustPageUrl: vendor.trustPageUrl ?? "", trustPageUrl: vendor.trustPageUrl || null,
businessOwnerId: vendor.businessOwner?.id, businessOwnerId: vendor.businessOwner?.id,
securityOwnerId: vendor.securityOwner?.id, securityOwnerId: vendor.securityOwner?.id,
}), }),

View File

@@ -41,20 +41,20 @@ export function CreateVendorDialog({
: { : {
organizationId, organizationId,
name: vendor.name, name: vendor.name,
description: vendor.description, description: vendor.description || null,
headquarterAddress: vendor.headquarterAddress, headquarterAddress: vendor.headquarterAddress || null,
legalName: vendor.legalName, legalName: vendor.legalName || null,
websiteUrl: vendor.websiteUrl, websiteUrl: vendor.websiteUrl || null,
category: vendor.category, category: vendor.category || null,
privacyPolicyUrl: vendor.privacyPolicyUrl, privacyPolicyUrl: vendor.privacyPolicyUrl || null,
serviceLevelAgreementUrl: vendor.serviceLevelAgreementUrl, serviceLevelAgreementUrl: vendor.serviceLevelAgreementUrl || null,
dataProcessingAgreementUrl: vendor.dataProcessingAgreementUrl, dataProcessingAgreementUrl: vendor.dataProcessingAgreementUrl || null,
certifications: vendor.certifications, certifications: vendor.certifications,
countries: vendor.countries, countries: vendor.countries,
securityPageUrl: vendor.securityPageUrl, securityPageUrl: vendor.securityPageUrl || null,
trustPageUrl: vendor.trustPageUrl, trustPageUrl: vendor.trustPageUrl || null,
statusPageUrl: vendor.statusPageUrl, statusPageUrl: vendor.statusPageUrl || null,
termsOfServiceUrl: vendor.termsOfServiceUrl, termsOfServiceUrl: vendor.termsOfServiceUrl || null,
}; };
createVendor({ createVendor({
variables: { variables: {