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:
@@ -10,6 +10,7 @@ using TrueCV.Application.Helpers;
|
||||
using TrueCV.Application.Interfaces;
|
||||
using TrueCV.Application.Models;
|
||||
using TrueCV.Infrastructure.Configuration;
|
||||
using TrueCV.Infrastructure.Helpers;
|
||||
using UglyToad.PdfPig;
|
||||
|
||||
namespace TrueCV.Infrastructure.Services;
|
||||
@@ -191,7 +192,7 @@ public sealed class CVParserService : ICVParserService
|
||||
}
|
||||
|
||||
// Clean up response - remove markdown code blocks if present
|
||||
responseText = CleanJsonResponse(responseText);
|
||||
responseText = JsonResponseHelper.CleanJsonResponse(responseText);
|
||||
|
||||
_logger.LogDebug("Received response from Claude API, parsing JSON");
|
||||
|
||||
@@ -213,28 +214,6 @@ public sealed class CVParserService : ICVParserService
|
||||
}
|
||||
}
|
||||
|
||||
private static string CleanJsonResponse(string response)
|
||||
{
|
||||
var trimmed = response.Trim();
|
||||
|
||||
// Remove markdown code blocks
|
||||
if (trimmed.StartsWith("```json", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
trimmed = trimmed[7..];
|
||||
}
|
||||
else if (trimmed.StartsWith("```"))
|
||||
{
|
||||
trimmed = trimmed[3..];
|
||||
}
|
||||
|
||||
if (trimmed.EndsWith("```"))
|
||||
{
|
||||
trimmed = trimmed[..^3];
|
||||
}
|
||||
|
||||
return trimmed.Trim();
|
||||
}
|
||||
|
||||
private static CVData MapToCVData(ClaudeCVResponse response)
|
||||
{
|
||||
return new CVData
|
||||
|
||||
Reference in New Issue
Block a user