diff --git a/dev-api.py b/dev-api.py index 7ec4baa..29d178f 100644 --- a/dev-api.py +++ b/dev-api.py @@ -983,13 +983,16 @@ class IdentitySyncPayload(BaseModel): @app.post("/api/settings/resume/sync-identity") def sync_identity(payload: IdentitySyncPayload): """Sync identity fields from profile store back to user.yaml.""" - data = load_user_profile(_user_yaml_path()) - data["name"] = payload.name - data["email"] = payload.email - data["phone"] = payload.phone - data["linkedin"] = payload.linkedin_url # yaml key is 'linkedin', not 'linkedin_url' - save_user_profile(_user_yaml_path(), data) - return {"ok": True} + try: + data = load_user_profile(_user_yaml_path()) + data["name"] = payload.name + data["email"] = payload.email + data["phone"] = payload.phone + data["linkedin"] = payload.linkedin_url # yaml key is 'linkedin', not 'linkedin_url' + save_user_profile(_user_yaml_path(), data) + return {"ok": True} + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) @app.put("/api/settings/profile") diff --git a/scripts/user_profile.py b/scripts/user_profile.py index 4334906..456b094 100644 --- a/scripts/user_profile.py +++ b/scripts/user_profile.py @@ -7,6 +7,8 @@ here so port/host/SSL changes propagate everywhere automatically. """ from __future__ import annotations from pathlib import Path +import os +import tempfile import yaml _DEFAULTS = { @@ -136,8 +138,6 @@ class UserProfile: def load_user_profile(config_path: str) -> dict: """Load user.yaml and return as a plain dict with safe defaults.""" - import yaml - from pathlib import Path path = Path(config_path) if not path.exists(): return {} @@ -148,10 +148,6 @@ def load_user_profile(config_path: str) -> dict: def save_user_profile(config_path: str, data: dict) -> None: """Atomically write the user profile dict to user.yaml.""" - import yaml - import os - import tempfile - from pathlib import Path path = Path(config_path) path.parent.mkdir(parents=True, exist_ok=True) # Write to temp file then rename for atomicity diff --git a/web/src/stores/settings/profile.ts b/web/src/stores/settings/profile.ts index 1812b9e..48eafca 100644 --- a/web/src/stores/settings/profile.ts +++ b/web/src/stores/settings/profile.ts @@ -57,7 +57,7 @@ export const useProfileStore = defineStore('settings/profile', () => { career_summary: career_summary.value, candidate_voice: candidate_voice.value, inference_profile: inference_profile.value, - mission_preferences: mission_preferences.value, + mission_preferences: mission_preferences.value.map(({ industry, note }) => ({ industry, note })), nda_companies: nda_companies.value, accessibility_focus: accessibility_focus.value, lgbtq_focus: lgbtq_focus.value, diff --git a/web/src/views/settings/MyProfileView.vue b/web/src/views/settings/MyProfileView.vue index 253209e..97fe0ca 100644 --- a/web/src/views/settings/MyProfileView.vue +++ b/web/src/views/settings/MyProfileView.vue @@ -138,7 +138,7 @@