feat: add mariadb production support deploy hardening and recruiter drafts

This commit is contained in:
cesnimda
2026-03-22 18:53:41 +01:00
parent 1fe3a68901
commit 16b9960c08
11 changed files with 130 additions and 9 deletions
@@ -1223,7 +1223,7 @@ namespace JobTrackerApi.Controllers
string? RecruiterMessageDraft);
public sealed record SaveTailoredCvRequest(string? TailoredCvText);
public sealed record GenerateApplicationPackageDto(string TailoredCvText, string? CoverLetterDraft, string? ApplicationAnswerDraft, string? RecruiterMessageDraft, List<string> KeyPoints);
public sealed record SaveApplicationDraftsRequest(string? CoverLetterText, string? Notes);
public sealed record SaveApplicationDraftsRequest(string? CoverLetterText, string? Notes, string? RecruiterMessageDraft);
public sealed record InterviewPrepDto(string Summary, List<string> TalkingPoints, List<string> LikelyQuestions, List<string> WeakSpots);
public sealed record ReadinessDto(int Score, string Level, List<string> Completed, List<string> Missing, List<string> Reminders);
@@ -1418,8 +1418,35 @@ Candidate CV/profile:
return NoContent();
}
[HttpPut("{id:int}/application-drafts")]
public async Task<IActionResult> SaveApplicationDrafts([FromRoute] int id, [FromBody] SaveApplicationDraftsRequest request, CancellationToken cancellationToken)
{
var job = await _db.JobApplications.FirstOrDefaultAsync(j => j.Id == id, cancellationToken);
if (job is null) return NotFound();
if (!string.IsNullOrWhiteSpace(request.CoverLetterText))
{
job.CoverLetterText = request.CoverLetterText.Trim();
}
if (!string.IsNullOrWhiteSpace(request.Notes))
{
job.Notes = string.IsNullOrWhiteSpace(job.Notes)
? request.Notes.Trim()
: $"{job.Notes.Trim()}\n\n{request.Notes.Trim()}";
}
if (!string.IsNullOrWhiteSpace(request.RecruiterMessageDraft))
{
job.RecruiterMessageDraft = request.RecruiterMessageDraft.Trim();
}
await _db.SaveChangesAsync(cancellationToken);
return NoContent();
}
[HttpPost("{id:int}/generate-application-package")]
public async Task<ActionResult<GenerateApplicationPackageDto>> GenerateApplicationPackage([FromRoute] int id, CancellationToken cancellationToken)
public async Task<ActionResult<GenerateApplicationPackageDto>> GenerateApplicationPackage([FromRoute] int id, [FromQuery] string? mode, CancellationToken cancellationToken)
{
var job = await _db.JobApplications
.Include(j => j.Company)
+1
View File
@@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3" />
</ItemGroup>
</Project>
+1 -6
View File
@@ -550,6 +550,7 @@ CREATE TABLE IF NOT EXISTS "GmailConnections" (
EnsureColumn(conn, "JobApplications", "ShortSummary", "ALTER TABLE JobApplications ADD COLUMN ShortSummary TEXT NULL;");
EnsureColumn(conn, "JobApplications", "TailoredCvText", "ALTER TABLE JobApplications ADD COLUMN TailoredCvText TEXT NULL;");
EnsureColumn(conn, "JobApplications", "TailoredCvUpdatedAt", "ALTER TABLE JobApplications ADD COLUMN TailoredCvUpdatedAt TEXT NULL;");
EnsureColumn(conn, "JobApplications", "RecruiterMessageDraft", "ALTER TABLE JobApplications ADD COLUMN RecruiterMessageDraft TEXT NULL;");
// Ensure ownership columns exist even on non-legacy DBs.
EnsureColumn(conn, "Companies", "OwnerUserId", "ALTER TABLE Companies ADD COLUMN OwnerUserId TEXT NULL;");
@@ -622,9 +623,3 @@ app.UseAuthorization();
app.MapControllers();
app.Run();