Update parent company validation to allow optional fields and handle null values in company details submission.

This commit is contained in:
2025-12-16 15:38:03 +05:30
parent 46daec00ce
commit 2767d29d79
2 changed files with 12 additions and 3 deletions

View File

@@ -159,6 +159,15 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise<
}
}
if (
companyDetailsRaw.parentCompany &&
Object.values(companyDetailsRaw.parentCompany).every(
(v) => v === undefined || v === null
)
) {
companyDetailsRaw.parentCompany = null;
}
/** 6) Profile update if provided */
if (fields.userProfile) {
const userProfileRaw = normalizeJsonField(fields, 'userProfile');