refactor(cv): centralize tailored templates
CI and Deploy / test (push) Successful in 5m35s
CI and Deploy / deploy (push) Successful in 2m6s

This commit is contained in:
cesnimda
2026-08-27 20:47:59 +02:00
parent 6b3acf7b07
commit 7c4e6fb5b7
6 changed files with 101 additions and 83 deletions
@@ -73,15 +73,7 @@ public sealed partial class ProfileCvController : ControllerBase
RenderOptions = new TailoredCvRenderOptions
{
ShowPhoto = true,
AccentColor = templateId switch
{
"harvard" => "brick",
"auckland" => "emerald",
"edinburgh" => "plum",
"monarch" => "#7c2d12",
"fjord" => "#0f4c5c",
_ => "slate",
},
AccentColor = TailoredCvTemplateCatalog.Resolve(templateId).AccentColor,
SectionOrder = new List<string> { "summary", "skills", "experience", "education", "custom" },
}
});
@@ -571,32 +571,10 @@ public sealed partial class ProfileCvController : ControllerBase
private static string DescribeRewriteTemplate(string templateId)
{
return templateId.ToLowerInvariant() switch
{
"harvard" => "Harvard template: refined, traditional, strong hierarchy, restrained and credible.",
"auckland" => "Auckland template: modern sidebar layout, crisp highlights, confident but readable.",
"edinburgh" => "Edinburgh template: polished editorial layout with stronger visual personality and premium spacing.",
"monarch" => "Monarch template: executive, premium, high-contrast emphasis on summary and leadership signals.",
"fjord" => "Fjord template: calm technical layout with clear information density and practical scanability.",
_ => "ATS Minimal template: clean, compact, scanner-friendly, and easy to tailor."
};
return TailoredCvTemplateCatalog.Resolve(templateId).RewriteGuidance;
}
private static string NormalizeTemplateId(string? value)
{
var normalized = (value ?? string.Empty).Trim().ToLowerInvariant();
return normalized switch
{
"base" => "ats-minimal",
"legacy-text" => "ats-minimal",
"harvard" => "harvard",
"auckland" => "auckland",
"edinburgh" => "edinburgh",
"monarch" => "monarch",
"fjord" => "fjord",
_ => "ats-minimal"
};
}
private static string NormalizeTemplateId(string? value) => TailoredCvTemplateCatalog.NormalizeId(value);
private static string? NormalizeRewriteSectionName(string? value)
{
@@ -642,17 +620,16 @@ public sealed partial class ProfileCvController : ControllerBase
private static IReadOnlyList<CvTemplateDescriptor> GetCvTemplateDescriptors()
{
// 7-arg shape matches CvTemplateDescriptor in ProfileCvDtos.cs. The LayoutFamily/AtsRating
// fields the branch added here are deferred with the rest of the ATS-badge work (Phase 4).
return new[]
{
new CvTemplateDescriptor("ats-minimal", "ATS Minimal", "Scanner-friendly", "slate", "Compact, direct, and easy to parse.", "Best for broad application flows and recruiter scanning.", new List<string> { "Tight hierarchy", "Keyword-friendly", "Low visual risk" }),
new CvTemplateDescriptor("harvard", "Harvard", "Traditional", "brick", "Formal and restrained.", "Good for conservative hiring flows or academic-adjacent applications.", new List<string> { "Classic serif rhythm", "Strong chronology", "Credible tone" }),
new CvTemplateDescriptor("auckland", "Auckland", "Modern sidebar", "emerald", "Sharper highlights with a contemporary cadence.", "Pulls key strengths into a faster visual scan.", new List<string> { "Sidebar details", "Compact highlights", "Modern contrast" }),
new CvTemplateDescriptor("edinburgh", "Edinburgh", "Editorial", "plum", "More personality without losing clarity.", "Useful when the CV should feel polished and distinctive.", new List<string> { "Premium spacing", "Stronger personality", "Readable density" }),
new CvTemplateDescriptor("monarch", "Monarch", "Executive", "#7c2d12", "High-contrast leadership emphasis.", "Works well for senior, strategic, or client-facing roles.", new List<string> { "Executive summary weight", "Premium accenting", "Decision-maker friendly" }),
new CvTemplateDescriptor("fjord", "Fjord", "Technical", "#0f4c5c", "Calm, dense, technical layout.", "Optimized for engineering resumes with richer project and skills detail.", new List<string> { "Technical depth", "Dense but readable", "Practical hierarchy" }),
};
return TailoredCvTemplateCatalog.Templates
.Select(template => new CvTemplateDescriptor(
template.Id,
template.Title,
template.Tone,
template.AccentColor,
template.PreviewTagline,
template.PreviewSummary,
template.PreviewBullets.ToList()))
.ToList();
}
private TailoredCvRenderResult RenderProfileCv(TailoredCvDocument document, ApplicationUser user, string targetRole, string? companyName)