Files
jobtrackingapp/Models/Job.cs
T
cesnimda eac34705e3 feat: Phase 0 foundation — Job entity, expanded pipeline, AI service lockdown, DateApplied history
Unblocks the documented core workflow and closes the AI-service exposure,
without changing existing behaviour.

Job/JobApplication split (additive; see ADR-002):
- New Job entity (the opportunity) with owner-scoped query filter; nullable
  JobApplication.JobId FK. Nothing reads Job yet.
- Migration AddJobEntityAndProspectStages, hand-edited to drop reconciler-owned
  tables the scaffolder re-emitted; verified against the real dev DB.

Pipeline: 10 internal stages across three concerns kept separate —
PipelineStage (workflow) / PipelineGroup (UI: NotApplied/Active/Closed) /
PipelineCategory (analytics). Adds Saved/Interested/Preparing/Withdrawn;
keeps Waiting and Ghosted. Kanban shows 3 grouped columns; cards keep a stage
chip and full transitions; drag applies only safe transitions (never infers
Ghosted/Withdrawn).

DateApplied nullable + SavedAt. Cleared when leaving Applied so analytics stay
accurate; the discarded date is preserved as an AppliedDateCleared JobEvent.

AI service lockdown: no host port; private ai_internal network (backend is the
only other member); X-Ai-Service-Token required on all non-/health endpoints;
AI_SERVICE_TOKEN mandatory via compose. Verified backend-only against the live
stack.

Also carries two pre-existing working-tree files (views/ProfilePage.tsx,
views/CareerWorkspacePage.tsx) so the tree is clean for the branch integration.

Tests: +40 backend (247 total), +5 sidecar (16), +15 frontend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 17:05:25 +02:00

58 lines
2.7 KiB
C#

using System;
namespace JobTrackerApi.Models
{
/// <summary>
/// A job opportunity — the role as the employer posted it, independent of whether the user
/// has applied. Separated from <see cref="JobApplication"/> (the user's pursuit of a job) so
/// that:
/// - a job can be tracked before it is applied to (see JobPipeline's Prospect stages), and
/// - applying twice to the same role does not duplicate the whole job description.
///
/// Introduced in Phase 0 (2026-07-17) as an additive step. Nothing reads from this table yet:
/// <see cref="JobApplication"/> still carries its own copy of these columns and remains the
/// source of truth for all current reads and writes. The cutover (dual-write, then flip reads,
/// then drop the legacy columns) is Phase 1 work.
///
/// See docs/decisions/ADR-002-job-application-model.md.
/// </summary>
public class Job
{
public int Id { get; set; }
public string? OwnerUserId { get; set; }
public int CompanyId { get; set; }
public Company Company { get; set; } = null!;
public string JobTitle { get; set; } = "";
public string? Location { 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? ShortSummary { get; set; }
public string? Tags { get; set; } // JSON array string, e.g. ["Azure","Docker"]
public DateTime? Deadline { get; set; }
// Structured salary; the free-text Salary field is kept for display/back-compat.
public string? Salary { get; set; }
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"
// Where this job came from. Market is data, not an assumption: Jobjakt is Norway-first
// but must not hardcode Norway, so country travels with the job rather than being
// implied by the importer. Null = unknown/manually entered.
public string? Source { get; set; } // e.g. "finn", "nav", "linkedin", "manual"
public string? CountryCode { get; set; } // ISO 3166-1 alpha-2, e.g. "NO", "GB"
/// <summary>When the user first captured this opportunity.</summary>
public DateTime SavedAt { get; set; } = DateTime.UtcNow;
public List<JobApplication> Applications { get; set; } = new();
}
}