fix(rd21): guard career and job saves with durable revisions

This commit is contained in:
cesnimda
2026-10-23 08:07:23 +02:00
parent 8f2cad67f7
commit 12f342c09c
32 changed files with 1185 additions and 277 deletions
+4 -4
View File
@@ -516,12 +516,14 @@ public sealed class AuthController : ControllerBase
return StatusCode(501, "Profile updates are only supported for local username/password accounts.");
}
if (request.ProfileCvText is not null || request.ProfileCvStructureJson is not null)
return BadRequest("Career data must be saved through /api/career/profile with its source revision.");
// Partial update. A field is only touched when the request actually carries it:
// - null / omitted -> leave unchanged (the caller isn't editing this field)
// - "" -> explicitly clear
// - "value" -> set (trimmed)
// This lets /profile save identity fields and /career save the master-profile fields
// through the same endpoint without one wiping the other. Email and UserName are the
// Career data uses its own atomic, revision-guarded endpoint. Email and UserName are the
// login identifiers and are never cleared to empty. Email ownership changes use the
// separate, token-confirmed email-change flow below.
if (request.UserName is not null)
@@ -532,8 +534,6 @@ public sealed class AuthController : ControllerBase
if (request.FirstName is not null) user.FirstName = TrimOrNull(request.FirstName);
if (request.LastName is not null) user.LastName = TrimOrNull(request.LastName);
if (request.DisplayName is not null) user.DisplayName = TrimOrNull(request.DisplayName);
if (request.ProfileCvText is not null) user.ProfileCvText = TrimOrNull(request.ProfileCvText);
if (request.ProfileCvStructureJson is not null) user.ProfileCvStructureJson = TrimOrNull(request.ProfileCvStructureJson);
var res = await _users.UpdateAsync(user);
if (!res.Succeeded)