Fix COMPANY verification snapshot dropping every field but company_name
All checks were successful
build-and-release / build (catering-services) (push) Successful in 13s
build-and-release / build (cron) (push) Successful in 12s
build-and-release / build (customers) (push) Successful in 13s
build-and-release / build (companies) (push) Successful in 16s
build-and-release / build (developers) (push) Successful in 6s
build-and-release / build (fitness-trainers) (push) Successful in 6s
build-and-release / build (employees) (push) Successful in 6s
build-and-release / build (gateway) (push) Successful in 5s
build-and-release / build (graphic-designers) (push) Successful in 6s
build-and-release / build (job-seekers) (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 5s
build-and-release / build (photographers) (push) Successful in 5s
build-and-release / build (social-media-managers) (push) Successful in 6s
build-and-release / build (tutors) (push) Successful in 5s
build-and-release / build (ugc-content-creators) (push) Successful in 6s
build-and-release / build (video-editors) (push) Successful in 6s
build-and-release / build (users) (push) Successful in 2m49s
All checks were successful
build-and-release / build (catering-services) (push) Successful in 13s
build-and-release / build (cron) (push) Successful in 12s
build-and-release / build (customers) (push) Successful in 13s
build-and-release / build (companies) (push) Successful in 16s
build-and-release / build (developers) (push) Successful in 6s
build-and-release / build (fitness-trainers) (push) Successful in 6s
build-and-release / build (employees) (push) Successful in 6s
build-and-release / build (gateway) (push) Successful in 5s
build-and-release / build (graphic-designers) (push) Successful in 6s
build-and-release / build (job-seekers) (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 5s
build-and-release / build (photographers) (push) Successful in 5s
build-and-release / build (social-media-managers) (push) Successful in 6s
build-and-release / build (tutors) (push) Successful in 5s
build-and-release / build (ugc-content-creators) (push) Successful in 6s
build-and-release / build (video-editors) (push) Successful in 6s
build-and-release / build (users) (push) Successful in 2m49s
fetch_saved_profile() is the fallback used by submit-for-verification
when the caller doesn't send profile_data (e.g. VerificationStatusPage's
resubmit-after-revision-request flow, which only sends {roleKey}). It's a
separate implementation from GET /api/profile and still had the same
stale COMPANY query that was already fixed there — SELECT company_name
only, discarding email/phone/website/address/city/state/pin/GST. The
admin verification sidebar renders exactly this snapshot, so a resubmit
made every other field vanish from the admin's review view. Select and
return the full column set, matching get_profile.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fd889efa22
commit
2da1ebc8be
1 changed files with 27 additions and 5 deletions
|
|
@ -893,15 +893,37 @@ async fn fetch_saved_profile(
|
||||||
role_key: &str,
|
role_key: &str,
|
||||||
) -> serde_json::Value {
|
) -> serde_json::Value {
|
||||||
if role_key == "COMPANY" {
|
if role_key == "COMPANY" {
|
||||||
return match sqlx::query(r#"SELECT company_name FROM company_profiles WHERE user_id = $1"#)
|
return match sqlx::query(
|
||||||
.bind(user_id)
|
r#"SELECT company_name, contact_email, contact_phone, website_url,
|
||||||
.fetch_optional(&state.pool)
|
address_line1, city, state, postal_code, gst_number
|
||||||
.await
|
FROM company_profiles WHERE user_id = $1"#,
|
||||||
|
)
|
||||||
|
.bind(user_id)
|
||||||
|
.fetch_optional(&state.pool)
|
||||||
|
.await
|
||||||
{
|
{
|
||||||
Ok(Some(r)) => {
|
Ok(Some(r)) => {
|
||||||
use sqlx::Row;
|
use sqlx::Row;
|
||||||
let name: Option<String> = r.try_get("company_name").ok();
|
let name: Option<String> = r.try_get("company_name").ok();
|
||||||
serde_json::json!({ "company_name": name })
|
let email: Option<String> = r.try_get("contact_email").ok();
|
||||||
|
let phone: Option<String> = r.try_get("contact_phone").ok();
|
||||||
|
let website: Option<String> = r.try_get("website_url").ok();
|
||||||
|
let address: Option<String> = r.try_get("address_line1").ok();
|
||||||
|
let city: Option<String> = r.try_get("city").ok();
|
||||||
|
let state_val: Option<String> = r.try_get("state").ok();
|
||||||
|
let postal: Option<String> = r.try_get("postal_code").ok();
|
||||||
|
let gst: Option<String> = r.try_get("gst_number").ok();
|
||||||
|
serde_json::json!({
|
||||||
|
"company_name": name,
|
||||||
|
"company_email": email,
|
||||||
|
"company_phone": phone,
|
||||||
|
"website": website,
|
||||||
|
"address": address,
|
||||||
|
"location": city,
|
||||||
|
"state": state_val,
|
||||||
|
"pin_code": postal,
|
||||||
|
"gst_number": gst,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
_ => serde_json::Value::Object(Default::default()),
|
_ => serde_json::Value::Object(Default::default()),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue