Persist structured CV section data

This commit is contained in:
cesnimda
2026-03-23 23:48:39 +01:00
parent 8f04637cff
commit c33640986e
5 changed files with 32 additions and 2 deletions
+7 -1
View File
@@ -1,3 +1,4 @@
using System.Text.Json;
using System.Security.Claims;
using JobTrackerApi.Models;
using JobTrackerApi.Services;
@@ -57,10 +58,11 @@ public sealed class AuthController : ControllerBase
string? LastName,
string? DisplayName,
string? ProfileCvText,
string? ProfileCvStructureJson,
string? AvatarImageDataUrl,
IList<string> Roles,
GoogleLinkDto? GoogleLink);
public sealed record UpdateProfileRequest(string? Email, string? UserName, string? FirstName, string? LastName, string? DisplayName, string? ProfileCvText);
public sealed record UpdateProfileRequest(string? Email, string? UserName, string? FirstName, string? LastName, string? DisplayName, string? ProfileCvText, string? ProfileCvStructureJson);
public sealed record GoogleTokenRequest(string Token);
[HttpPost("login")]
@@ -173,6 +175,7 @@ public sealed class AuthController : ControllerBase
LastName: User.FindFirstValue("family_name"),
DisplayName: User.FindFirstValue("name"),
ProfileCvText: null,
ProfileCvStructureJson: null,
AvatarImageDataUrl: null,
Roles: Array.Empty<string>(),
GoogleLink: provider == "google" ? new GoogleLinkDto(false, email, null) : null));
@@ -194,6 +197,7 @@ public sealed class AuthController : ControllerBase
var lastName = TrimOrNull(request.LastName);
var displayName = TrimOrNull(request.DisplayName);
var profileCvText = TrimOrNull(request.ProfileCvText);
var profileCvStructureJson = TrimOrNull(request.ProfileCvStructureJson);
if (email is not null) user.Email = email;
if (userName is not null) user.UserName = userName;
@@ -201,6 +205,7 @@ public sealed class AuthController : ControllerBase
user.LastName = lastName;
user.DisplayName = displayName;
user.ProfileCvText = profileCvText;
user.ProfileCvStructureJson = profileCvStructureJson;
var res = await _users.UpdateAsync(user);
if (!res.Succeeded)
@@ -440,6 +445,7 @@ public sealed class AuthController : ControllerBase
LastName: user.LastName,
DisplayName: user.DisplayName,
ProfileCvText: user.ProfileCvText,
ProfileCvStructureJson: user.ProfileCvStructureJson,
AvatarImageDataUrl: user.AvatarImageDataUrl,
Roles: roles,
GoogleLink: new GoogleLinkDto(