fix(career): preserve reviewed profile values
CI and Deploy / test (pull_request) Successful in 4m39s
CI and Deploy / deploy (pull_request) Has been skipped

Keep extraction heuristics out of manual save, version, and import paths so reviewed locations, URLs, dates, and languages round-trip unchanged.
This commit is contained in:
cesnimda
2026-08-15 16:56:31 +02:00
parent a6cffe0473
commit f0b9b222ff
15 changed files with 277 additions and 37 deletions
@@ -51,7 +51,7 @@ public sealed class CareerProfileController : ControllerBase
var user = await _users.GetUserAsync(User);
if (user is null) return StatusCode(501, "The career profile can only be edited on local accounts.");
var profile = StructuredCvProfileJson.Normalize(request?.Profile);
var profile = StructuredCvProfileJson.NormalizeForPersistence(request?.Profile);
var error = CareerProfileValidator.Validate(profile);
if (error is not null) return BadRequest(error);
@@ -59,7 +59,7 @@ public sealed class CareerProfileController : ControllerBase
// Keep the derived projection in sync for legacy readers. CvText (the raw imported text) is
// part of the career profile and is set here too; identity fields are never touched.
user.ProfileCvStructureJson = StructuredCvProfileJson.Serialize(saved);
user.ProfileCvStructureJson = StructuredCvProfileJson.SerializePersisted(saved);
if (request?.CvText is not null) user.ProfileCvText = string.IsNullOrWhiteSpace(request.CvText) ? null : request.CvText;
var res = await _users.UpdateAsync(user);
if (!res.Succeeded) return BadRequest(string.Join("; ", res.Errors.Select(e => e.Description)));
@@ -100,7 +100,7 @@ public sealed class CareerProfileController : ControllerBase
var restored = await _career.RestoreVersionAsync(user.Id, version, cancellationToken);
if (restored is null) return NotFound($"Version {version} was not found.");
user.ProfileCvStructureJson = StructuredCvProfileJson.Serialize(restored);
user.ProfileCvStructureJson = StructuredCvProfileJson.SerializePersisted(restored);
var res = await _users.UpdateAsync(user);
if (!res.Succeeded) return BadRequest(string.Join("; ", res.Errors.Select(e => e.Description)));