Files
jobtrackingapp/Models/JobApplication.cs
cesnimda 83e6430a24 feat: structured salary fields (min/max/currency/period)
Adds SalaryMin/SalaryMax/SalaryCurrency/SalaryPeriod alongside the
existing free-text Salary field (kept for back-compat and display).

- JobApplication model + idempotent column bridging for SQLite and MySQL
- Create/Update DTOs with NormalizeSalary (clamps negatives, swaps
  inverted min/max, uppercases currency, whitelists period)
- JobApplicationDto exposes the fields; CSV export gains 4 columns
- UI: add/edit dialogs get min/max/currency/period inputs; job table
  renders a formatted range via shared salary.ts formatter (falls back
  to free-text when structured values are absent)
- EN/NB translations; backend + full frontend suites green

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 22:15:37 +02:00

63 lines
2.6 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
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;
}
}