fix(jobs): derive attachment checklist flags from actual Attachments
Backlog item 4 (Wave 3, first sub-item). HasResume/HasCoverLetter/HasPortfolio/ HasOtherAttachment were manually-editable checkboxes in EditJobDialog, completely independent of whether a file was actually attached -- classic drift: mark 'resume ready' by hand, later delete the resume attachment, flag stays stuck true forever. User confirmed (asked directly, since removing the manual-override capability is a product decision, not purely technical): make them fully computed from Attachments, no manual override. - AttachmentsController.RecomputeAttachmentFlagsAsync: the single place these four fields get written now, called after every attachment mutation (upload, delete, Purpose change) that could affect them. Deliberately kept as persisted columns (not [NotMapped] computed properties reading the Attachments navigation collection) -- ~15 query sites build JobApplication DTOs without .Include(Attachments), so a live-computed property would silently return false everywhere instead of throwing, the worst kind of bug. Recomputing at the one write funnel avoids touching any read path. - Removed HasResume/etc from CreateJobApplicationRequest/ UpdateJobApplicationRequest -- no longer client-settable. - EditJobDialog: removed the manual checkboxes, kept the (now genuinely accurate) read-only status chips. - AddJobModal: stopped sending has*-flags at job-creation time; the follow-up attachment upload call now sets them correctly via the same recompute path. Caught a real bug while testing this: the Purpose-change path recomputed before saving the Purpose change, so a fresh query missed the pending edit and the flags never updated. Fixed by committing the mutation before recomputing. 3 new backend tests (purpose-change sets flag, delete clears flag, non-primary purpose counts as "other"). 172/172 backend, 25/25 frontend suites (57 tests) green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1376,11 +1376,7 @@ Canonical profile:
|
||||
string? CoverLetterText,
|
||||
string? JobUrl,
|
||||
DateTime? DateApplied,
|
||||
DateTime? FeedbackRequestedAt,
|
||||
bool? HasResume,
|
||||
bool? HasCoverLetter,
|
||||
bool? HasPortfolio,
|
||||
bool? HasOtherAttachment
|
||||
DateTime? FeedbackRequestedAt
|
||||
);
|
||||
|
||||
private static (decimal? Min, decimal? Max, string? Currency, string? Period) NormalizeSalary(
|
||||
@@ -1422,10 +1418,9 @@ Canonical profile:
|
||||
NextAction = string.IsNullOrWhiteSpace(request.NextAction) ? null : request.NextAction.Trim(),
|
||||
FollowUpAt = request.FollowUpAt,
|
||||
FeedbackRequestedAt = request.FeedbackRequestedAt,
|
||||
HasResume = request.HasResume ?? false,
|
||||
HasCoverLetter = request.HasCoverLetter ?? false,
|
||||
HasPortfolio = request.HasPortfolio ?? false,
|
||||
HasOtherAttachment = request.HasOtherAttachment ?? false,
|
||||
// HasResume/HasCoverLetter/HasPortfolio/HasOtherAttachment are derived from
|
||||
// Attachment rows (see AttachmentsController.RecomputeAttachmentFlagsAsync), not
|
||||
// settable here -- they start false and get set correctly once files are uploaded.
|
||||
Notes = string.IsNullOrWhiteSpace(request.Notes) ? null : request.Notes,
|
||||
Description = string.IsNullOrWhiteSpace(request.Description) ? null : request.Description,
|
||||
TranslatedDescription = string.IsNullOrWhiteSpace(request.TranslatedDescription) ? null : request.TranslatedDescription,
|
||||
@@ -1486,10 +1481,6 @@ Canonical profile:
|
||||
string? SalaryPeriod,
|
||||
string? NextAction,
|
||||
DateTime? FollowUpAt,
|
||||
bool? HasResume,
|
||||
bool? HasCoverLetter,
|
||||
bool? HasPortfolio,
|
||||
bool? HasOtherAttachment,
|
||||
string? Notes,
|
||||
string? Description,
|
||||
string? TranslatedDescription,
|
||||
@@ -1529,10 +1520,8 @@ Canonical profile:
|
||||
job.NextAction = string.IsNullOrWhiteSpace(request.NextAction) ? null : request.NextAction.Trim();
|
||||
job.FollowUpAt = request.FollowUpAt;
|
||||
job.FeedbackRequestedAt = request.FeedbackRequestedAt;
|
||||
if (request.HasResume is not null) job.HasResume = request.HasResume.Value;
|
||||
if (request.HasCoverLetter is not null) job.HasCoverLetter = request.HasCoverLetter.Value;
|
||||
if (request.HasPortfolio is not null) job.HasPortfolio = request.HasPortfolio.Value;
|
||||
if (request.HasOtherAttachment is not null) job.HasOtherAttachment = request.HasOtherAttachment.Value;
|
||||
// HasResume/HasCoverLetter/HasPortfolio/HasOtherAttachment are derived from
|
||||
// Attachment rows, not settable here -- see AttachmentsController.RecomputeAttachmentFlagsAsync.
|
||||
job.Notes = request.Notes;
|
||||
job.Description = request.Description;
|
||||
job.TranslatedDescription = request.TranslatedDescription;
|
||||
|
||||
Reference in New Issue
Block a user