Implement code review fixes and improvements

- Move admin credentials from hardcoded values to configuration
- Add rate limiting (5/min) to login endpoint for brute force protection
- Extract CleanJsonResponse to shared JsonResponseHelper class
- Add DateHelpers.MonthsBetween utility and consolidate date calculations
- Update PdfReportService to use ScoreThresholds constants
- Remove 5 unused shared components (EmploymentTable, FlagsList, etc.)
- Clean up unused CSS from MainLayout.razor.css
- Create IPdfReportService interface for better testability
- Add authentication requirement to Hangfire dashboard in development
- Seal EducationVerifierService class

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 02:09:26 +01:00
parent 3a33119bea
commit 45ca5f6a05
19 changed files with 141 additions and 1445 deletions

View File

@@ -745,8 +745,7 @@ public sealed class ProcessCVCheckJob
if (seniorityJump >= 3)
{
// Calculate time between roles
var monthsBetween = ((currRole.StartDate!.Value.Year - prevRole.StartDate!.Value.Year) * 12) +
(currRole.StartDate!.Value.Month - prevRole.StartDate!.Value.Month);
var monthsBetween = DateHelpers.MonthsBetween(prevRole.StartDate!.Value, currRole.StartDate!.Value);
// If jumped 3+ levels in less than 2 years, flag it
if (monthsBetween < 24)
@@ -788,8 +787,7 @@ public sealed class ProcessCVCheckJob
foreach (var emp in employment.Where(e => e.StartDate.HasValue))
{
var monthsAfterEducation = ((emp.StartDate!.Value.Year - latestEducationEnd.Year) * 12) +
(emp.StartDate!.Value.Month - latestEducationEnd.Month);
var monthsAfterEducation = DateHelpers.MonthsBetween(latestEducationEnd, emp.StartDate!.Value);
// Check if this is a senior role started within 2 years of finishing education
if (monthsAfterEducation < 24 && monthsAfterEducation >= 0)
@@ -835,8 +833,7 @@ public sealed class ProcessCVCheckJob
if (role.StartDate.HasValue)
{
var endDate = role.EndDate ?? DateOnly.FromDateTime(DateTime.Today);
var months = ((endDate.Year - role.StartDate.Value.Year) * 12) +
(endDate.Month - role.StartDate.Value.Month);
var months = DateHelpers.MonthsBetween(role.StartDate.Value, endDate);
totalMonths += Math.Max(0, months);
}
}
@@ -953,7 +950,7 @@ public sealed class ProcessCVCheckJob
.Select(e => e.EndDate ?? DateOnly.FromDateTime(DateTime.Today))
.Max();
var totalMonths = ((latestEnd.Year - earliestStart.Year) * 12) + (latestEnd.Month - earliestStart.Month);
var totalMonths = DateHelpers.MonthsBetween(earliestStart, latestEnd);
var years = totalMonths / 12;
var months = totalMonths % 12;
@@ -1011,8 +1008,7 @@ public sealed class ProcessCVCheckJob
if (lastRole?.EndDate != null)
{
var monthsSince = ((DateTime.Today.Year - lastRole.EndDate.Value.Year) * 12) +
(DateTime.Today.Month - lastRole.EndDate.Value.Month);
var monthsSince = DateHelpers.MonthsBetween(lastRole.EndDate.Value, DateOnly.FromDateTime(DateTime.Today));
if (monthsSince > 0)
{
@@ -1041,7 +1037,7 @@ public sealed class ProcessCVCheckJob
.Select(e =>
{
var endDate = e.EndDate ?? DateOnly.FromDateTime(DateTime.Today);
var months = ((endDate.Year - e.StartDate!.Value.Year) * 12) + (endDate.Month - e.StartDate.Value.Month);
var months = DateHelpers.MonthsBetween(e.StartDate!.Value, endDate);
return new { Entry = e, Months = months };
})
.Where(x => x.Months >= longTenureMonths)