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>
This commit is contained in:
cesnimda
2026-07-17 17:05:25 +02:00
parent b176a44627
commit eac34705e3
36 changed files with 3060 additions and 96 deletions
@@ -41,7 +41,11 @@ namespace JobTrackerApi.Controllers
Company Company,
string JobTitle,
string Status,
DateTime DateApplied,
// Null while the job is in a pre-application (Prospect) stage — nothing submitted yet.
DateTime? DateApplied,
// When the user captured the job. Always set, so clients have a date to sort/show for
// jobs that have no DateApplied yet.
DateTime SavedAt,
bool ResponseReceived,
DateTime? ResponseDate,
string? Notes,
@@ -67,7 +71,8 @@ namespace JobTrackerApi.Controllers
bool HasOtherAttachment,
bool IsDeleted,
DateTime? DeletedAt,
int DaysSince,
// Null when DateApplied is null: no elapsed time to report before applying.
int? DaysSince,
bool NeedsFollowUp,
string? FollowUpReason,
string? TailoredCvText,
@@ -129,7 +134,10 @@ namespace JobTrackerApi.Controllers
public sealed record UpdateStatusRequest(string Status);
public sealed record PipelineStageDto(string Key, int Order, string Category);
// Category = analytics semantics (Prospect/Active/Success/Closed).
// Group = how the board collapses stages (NotApplied/Active/Closed). Different axes on purpose
// — Offer is Success but still actively worked. See JobPipeline.PipelineGroup.
public sealed record PipelineStageDto(string Key, int Order, string Category, string Group);
public sealed record StatusSuggestionDto(
bool HasSuggestion,
@@ -152,7 +160,7 @@ namespace JobTrackerApi.Controllers
public sealed record TagTrendSeries(string Tag, List<int> Counts);
public sealed record TagTrendPoint(string Month, List<int> Counts);
public sealed record DuplicateCandidateDto(int Id, string JobTitle, string Company, string? JobUrl, string Status, DateTime DateApplied, string Reason);
public sealed record DuplicateCandidateDto(int Id, string JobTitle, string Company, string? JobUrl, string Status, DateTime? DateApplied, string Reason);
public sealed record DuplicateCheckResult(bool HasDuplicates, List<DuplicateCandidateDto> Matches);
public sealed record FollowUpDraftDto(string Subject, string Body, string Reason, DateTime SuggestedSendOn, string ContextSummary, List<string> ContextSignals, string? ThreadSubject, string? LastCorrespondenceFrom, DateTime? LastCorrespondenceAt);
public sealed record FocusPlanDto(