feat: Display candidate name from CV data instead of filename

- Added CandidateName field to CVCheckDto
- Extract candidate name from ReportJson or ExtractedDataJson
- Dashboard now shows actual candidate name for JSON uploads
- PDF export uses candidate name from report

This fixes the issue where JSON files showed their filename (e.g.,
"CLEAN-001") instead of the actual candidate name from the CV data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 21:23:48 +00:00
parent ecb599fba7
commit 6773162426
3 changed files with 31 additions and 2 deletions

View File

@@ -184,10 +184,38 @@ public sealed class CVCheckService : ICVCheckService
private static CVCheckDto MapToDto(CVCheck cvCheck)
{
string? candidateName = null;
// Try to get candidate name from ReportJson first (completed checks)
if (!string.IsNullOrEmpty(cvCheck.ReportJson))
{
try
{
var report = JsonSerializer.Deserialize<VeracityReport>(cvCheck.ReportJson, JsonDefaults.CamelCase);
candidateName = report?.CandidateName;
}
catch { /* Ignore deserialization errors */ }
}
// Fallback to ExtractedDataJson if no name in report
if (string.IsNullOrEmpty(candidateName) && !string.IsNullOrEmpty(cvCheck.ExtractedDataJson))
{
try
{
using var doc = JsonDocument.Parse(cvCheck.ExtractedDataJson);
if (doc.RootElement.TryGetProperty("fullName", out var nameElement))
{
candidateName = nameElement.GetString();
}
}
catch { /* Ignore deserialization errors */ }
}
return new CVCheckDto
{
Id = cvCheck.Id,
OriginalFileName = cvCheck.OriginalFileName,
CandidateName = candidateName,
Status = cvCheck.Status.ToString(),
VeracityScore = cvCheck.VeracityScore,
ProcessingStage = cvCheck.ProcessingStage,