fix: company profile submission stored wrapper object as verification payload
All checks were successful
build-and-release / build (customers) (push) Successful in 8s
build-and-release / build (catering-services) (push) Successful in 11s
build-and-release / build (fitness-trainers) (push) Successful in 4s
build-and-release / build (developers) (push) Successful in 14s
build-and-release / build (gateway) (push) Successful in 5s
build-and-release / build (employees) (push) Successful in 15s
build-and-release / build (cron) (push) Successful in 18s
build-and-release / build (graphic-designers) (push) Successful in 5s
build-and-release / build (job-seekers) (push) Successful in 5s
build-and-release / build (leads) (push) Successful in 6s
build-and-release / build (jobs) (push) Successful in 6s
build-and-release / build (makeup-artists) (push) Successful in 6s
build-and-release / build (payments) (push) Successful in 4s
build-and-release / build (photographers) (push) Successful in 5s
build-and-release / build (social-media-managers) (push) Successful in 4s
build-and-release / build (tutors) (push) Successful in 6s
build-and-release / build (ugc-content-creators) (push) Successful in 4s
build-and-release / build (video-editors) (push) Successful in 4s
build-and-release / build (users) (push) Successful in 6s
build-and-release / build (companies) (push) Successful in 2m2s

submit_with_documents parsed the multipart 'profile' field (shaped
{roleKey, profile_data: {...}} per the frontend wizard) but read fields
like company_name directly off the outer wrapper instead of unwrapping
profile_data first - every company_profiles field ended up blank, and
the double-wrapped object got stored as the verification's payload,
breaking admin-side rendering of company name/details.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Ashwin Kumar Sivakumar 2026-07-19 22:03:36 +05:30
parent 8b648e73d0
commit 00923681ec

View file

@ -902,7 +902,7 @@ async fn submit_with_documents(
}
};
let profile_obj: serde_json::Value = match serde_json::from_str(&profile_str) {
let profile_wrapper: serde_json::Value = match serde_json::from_str(&profile_str) {
Ok(v) => v,
Err(e) => {
return (
@ -913,6 +913,18 @@ async fn submit_with_documents(
}
};
// The frontend sends `{ roleKey, profile_data: {...actual fields} }` (see
// submitCompanyProfileWithDocuments in nxtgauge-frontend-solid/src/lib/api.ts).
// Unwrap `profile_data` here so every field lookup below and the verification
// payload we store operate on the actual company fields, not the outer wrapper -
// reading e.g. `company_name` directly off the wrapper always came back empty,
// and storing the wrapper itself as the verification payload made admin-side
// rendering of company name/details break for every submission through this path.
let profile_obj: serde_json::Value = profile_wrapper
.get("profile_data")
.cloned()
.unwrap_or(profile_wrapper);
// ---- 2. Save profile to `company_profiles` (DRAFT upsert). ----
// SQL mapping copied verbatim from apps/users/src/handlers/profile.rs:236-335 (COMPANY branch).
let name = profile_obj