b4fd5e2f96
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>
65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System;
|
|
|
|
namespace JobTrackerApi.Models
|
|
{
|
|
public class JobApplication
|
|
{
|
|
public int Id { get; set; }
|
|
public string? OwnerUserId { get; set; }
|
|
public string JobTitle { get; set; } = "";
|
|
public int CompanyId { get; set; }
|
|
public Company Company { get; set; } = null!;
|
|
public string Status { get; set; } = "Applied";
|
|
public DateTime DateApplied { get; set; } = DateTime.UtcNow;
|
|
public string? Location { get; set; }
|
|
public string? Salary { get; set; }
|
|
|
|
// Structured salary; the free-text Salary field is kept for display/back-compat.
|
|
public decimal? SalaryMin { get; set; }
|
|
public decimal? SalaryMax { get; set; }
|
|
public string? SalaryCurrency { get; set; } // e.g. "NOK", "GBP", "EUR"
|
|
public string? SalaryPeriod { get; set; } // "year" | "month" | "hour"
|
|
public string? NextAction { get; set; }
|
|
public DateTime? FollowUpAt { get; set; }
|
|
public DateTime? FeedbackRequestedAt { get; set; }
|
|
public string? RecruiterMessageDraft { get; set; }
|
|
|
|
// Attachment checklist. Derived from Attachment rows, not directly settable by API
|
|
// consumers -- see AttachmentsController.RecomputeAttachmentFlagsAsync, the single place
|
|
// these are written, so they can't drift from what's actually attached.
|
|
public bool HasResume { get; set; } = false;
|
|
public bool HasCoverLetter { get; set; } = false;
|
|
public bool HasPortfolio { get; set; } = false;
|
|
public bool HasOtherAttachment { get; set; } = false;
|
|
|
|
// Soft delete: hide from default queries without losing history.
|
|
public bool IsDeleted { get; set; } = false;
|
|
public DateTime? DeletedAt { get; set; }
|
|
|
|
public bool ResponseReceived { get; set; } = false;
|
|
public DateTime? ResponseDate { get; set; }
|
|
public string? Notes { get; set; }
|
|
public string? CoverLetterText { get; set; }
|
|
public string? JobUrl { get; set; }
|
|
|
|
// Imported job content
|
|
public string? Description { get; set; }
|
|
public string? TranslatedDescription { get; set; }
|
|
public string? DescriptionLanguage { get; set; } // "en", "no", ...
|
|
public string? Tags { get; set; } // JSON array string, e.g. ["Azure","Docker"]
|
|
public DateTime? Deadline { get; set; }
|
|
// Short summary generated at creation time and persisted to avoid repeated model calls.
|
|
public string? ShortSummary { get; set; }
|
|
public string? TailoredCvText { get; set; }
|
|
public DateTime? TailoredCvUpdatedAt { get; set; }
|
|
public DateTime? LastReminderEmailSentAt { get; set; }
|
|
|
|
public TailoredCvDraft? TailoredCvDraft { get; set; }
|
|
public List<Correspondence> Messages { get; set; } = new();
|
|
public List<Attachment> Attachments { get; set; } = new();
|
|
public List<JobEvent> Events { get; set; } = new();
|
|
|
|
public int DaysSince => ((ResponseReceived ? (ResponseDate ?? DateTime.UtcNow) : DateTime.UtcNow) - DateApplied.ToUniversalTime()).Days;
|
|
}
|
|
}
|