docs: consolidate repository guides and preserve audit history

This commit is contained in:
cesnimda
2026-09-11 14:22:41 +02:00
parent 115441a409
commit 682a3028bb
404 changed files with 3402 additions and 2621 deletions
@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore;
namespace JobTrackerApi.Controllers;
// Phase 5 — the AI Workspace for one job application. Every module runs through ISummarizerService and
// is stored as append-only history; nothing is applied automatically. docs/architecture/ai-career-assistant.md.
// is stored as append-only history; nothing is applied automatically. docs/ai/architecture.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}/ai")]
[Authorize(AuthenticationSchemes = "local")]
@@ -12,7 +12,7 @@ namespace JobTrackerApi.Controllers;
// /api/cv (CvVariantController), and documents stay on /api/attachments. These routes only cover what
// is genuinely application-scoped — which variant this application uses, what to tailor, and the
// cover letter with its history. Every route is tenant-scoped and returns 404 for another user's
// application. docs/architecture/application-workspace.md.
// application. docs/architecture/overview.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}")]
[Authorize(AuthenticationSchemes = "local")]
@@ -8,7 +8,7 @@ namespace JobTrackerApi.Controllers;
// Phase 5 Milestone 2 — the application checklist. System items seed themselves on first read from the
// existing readiness signals; the user owns everything after that.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}/checklist")]
[Authorize(AuthenticationSchemes = "local")]
@@ -11,7 +11,7 @@ namespace JobTrackerApi.Controllers;
//
// None of them write anything. The AI narrative for analysis and match stays on the existing
// /api/jobapplications/{id}/ai routes, which are suggestion-only and versioned by AiInteraction.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}")]
[Authorize(AuthenticationSchemes = "local")]
@@ -8,7 +8,7 @@ namespace JobTrackerApi.Controllers;
// Phase 5 Milestone 1 — one aggregate read for the Application Workspace overview, so the page loads
// from a single call instead of fanning out. Read-only; owns no data.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}/workspace")]
[Authorize(AuthenticationSchemes = "local")]
@@ -11,7 +11,7 @@ namespace JobTrackerApi.Controllers;
// here. The relational children (via CareerProfileService) are the source of truth; the
// ApplicationUser.ProfileCvStructureJson blob is kept in sync as a derived projection so the legacy
// read paths (CV rendering, tailoring, match-score) keep working. See
// docs/architecture/career-profile-model.md.
// docs/architecture/overview.md.
[ApiController]
[Route("api/career/profile")]
[Authorize]
@@ -10,7 +10,7 @@ namespace JobTrackerApi.Controllers
[ApiController]
// Explicitly authorized. These endpoints are all tenant-scoped user data, so they must not
// depend on the Auth:Require fallback policy being switched on: a deployment that lost that flag
// would otherwise serve them anonymously. docs/production-readiness-review.md.
// would otherwise serve them anonymously. docs/security/security-notes.md.
[Route("api/companies")]
[Authorize(AuthenticationSchemes = "local")]
public class CompaniesController : ControllerBase
@@ -11,7 +11,7 @@ namespace JobTrackerApi.Controllers
[ApiController]
// Explicitly authorized. These endpoints are all tenant-scoped user data, so they must not
// depend on the Auth:Require fallback policy being switched on: a deployment that lost that flag
// would otherwise serve them anonymously. docs/production-readiness-review.md.
// would otherwise serve them anonymously. docs/security/security-notes.md.
[Route("api/correspondence")]
[Authorize(AuthenticationSchemes = "local")]
public class CorrespondenceController : ControllerBase
@@ -8,7 +8,7 @@ namespace JobTrackerApi.Controllers;
// Phase 4 — Career Workspace Builder API. Every endpoint reads the master profile through
// ICareerProfileService and renders through the data-driven theme engine; none of them store career
// data. docs/architecture/cv-builder.md.
// data. docs/architecture/overview.md.
[ApiController]
[Route("api/cv")]
[Authorize(AuthenticationSchemes = "local")]
@@ -11,7 +11,7 @@ namespace JobTrackerApi.Controllers;
// Prep content is the user's; AI suggestions come from the existing /api/jobapplications/{id}/ai
// routes and only reach here once the user accepts one (POST with source "ai"). Communication stays
// entirely on the existing Correspondence routes — there is no messaging endpoint here.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
[ApiController]
[Route("api/jobapplications/{jobId:int}")]
[Authorize(AuthenticationSchemes = "local")]
@@ -20,7 +20,7 @@ namespace JobTrackerApi.Controllers
[ApiController]
// Explicitly authorized. These endpoints are all tenant-scoped user data, so they must not
// depend on the Auth:Require fallback policy being switched on: a deployment that lost that flag
// would otherwise serve them anonymously. docs/production-readiness-review.md.
// would otherwise serve them anonymously. docs/security/security-notes.md.
[Route("api/jobapplications")]
[Authorize(AuthenticationSchemes = "local")]
public class JobApplicationsController : ControllerBase
@@ -1356,7 +1356,7 @@ Candidate CV/profile:
// application checklist is the one workflow surface; readiness projects it into the score /
// completed / missing / reminders health view the dialog and dashboard already consume, so
// the two can never disagree. The DTO shape is unchanged on purpose.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
var checklist = job.OwnerUserId is null
? null
: await _checklist.GetAsync(job.OwnerUserId, id, cancellationToken);
@@ -7,7 +7,7 @@ namespace JobTrackerApi.Controllers;
[ApiController]
// Explicitly authorized. These endpoints are all tenant-scoped user data, so they must not
// depend on the Auth:Require fallback policy being switched on: a deployment that lost that flag
// would otherwise serve them anonymously. docs/production-readiness-review.md.
// would otherwise serve them anonymously. docs/security/security-notes.md.
[Route("api/jobimport")]
[Authorize(AuthenticationSchemes = "local")]
public sealed class JobImportController : ControllerBase
@@ -29,4 +29,3 @@ public sealed class JobImportController : ControllerBase
return Ok(result);
}
}
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.RateLimiting;
namespace JobTrackerApi.Controllers;
// Anonymous read-only surface for public CVs: /cv/{slug} in the SPA fetches this. Only variants the
// owner has explicitly toggled public are served; noindex by default. docs/architecture/cv-builder.md.
// owner has explicitly toggled public are served; noindex by default. docs/architecture/overview.md.
[ApiController]
[Route("api/public-cv")]
[AllowAnonymous]
+1 -1
View File
@@ -9,7 +9,7 @@ namespace JobTrackerApi.Controllers
[ApiController]
// Explicitly authorized. These endpoints are all tenant-scoped user data, so they must not
// depend on the Auth:Require fallback policy being switched on: a deployment that lost that flag
// would otherwise serve them anonymously. docs/production-readiness-review.md.
// would otherwise serve them anonymously. docs/security/security-notes.md.
[Route("api/rules")]
[Authorize(AuthenticationSchemes = "local")]
public class RulesController : ControllerBase
+7 -7
View File
@@ -385,7 +385,7 @@ namespace JobTrackerApi.Data
modelBuilder.Entity<UserSession>()
.HasIndex(x => x.UserId);
// Career Workspace foundation (docs/career-workspace-implementation-roadmap.md Phase F1).
// Career Workspace foundation (docs/roadmap/todo.md).
// One CareerProfile per user for now -- see roadmap "Not now: multiple profiles per user".
modelBuilder.Entity<CareerProfile>()
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
@@ -412,7 +412,7 @@ namespace JobTrackerApi.Data
.OnDelete(DeleteBehavior.Cascade);
// Phase 3: relational children of CareerProfile (the editable master profile).
// docs/architecture/career-profile-model.md. Same deny-on-null tenant filter as everything
// docs/architecture/overview.md. Same deny-on-null tenant filter as everything
// else; cascade-delete with the parent; indexed by (OwnerUserId, CareerProfileId, SortOrder)
// for the ordered per-profile reads the /career editor does.
ConfigureCareerChild<CareerExperience>(modelBuilder);
@@ -470,7 +470,7 @@ namespace JobTrackerApi.Data
.OnDelete(DeleteBehavior.Cascade);
// Phase 4: CV variants (a lens over the master profile) + their autosave history.
// docs/architecture/cv-builder.md. Same deny-on-null tenant filter as everything else. A
// docs/architecture/overview.md. Same deny-on-null tenant filter as everything else. A
// variant references a job application (reference-not-ownership, SetNull on delete) and never
// owns career data. PublicSlug is globally unique so /cv/{slug} can resolve it anonymously.
modelBuilder.Entity<CvVariant>()
@@ -504,7 +504,7 @@ namespace JobTrackerApi.Data
// Phase 5: append-only AI interaction history per job application. Same deny-on-null tenant
// filter; indexed for the per-job history read; cascades with the application.
// docs/architecture/ai-career-assistant.md.
// docs/ai/architecture.md.
modelBuilder.Entity<AiInteraction>()
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
// varchar (not longtext) for the indexed columns — see the CvVariant note above.
@@ -532,7 +532,7 @@ namespace JobTrackerApi.Data
// Phase 5 Milestone 2: the application checklist — a workflow guidance layer over the existing
// readiness signals, not a second store of truth. Same deny-on-null tenant filter; cascades with
// the application. docs/architecture/application-workspace.md.
// the application. docs/architecture/overview.md.
modelBuilder.Entity<ApplicationChecklistItem>()
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
// varchar (not longtext) for the indexed columns — see the CvVariant note above.
@@ -557,7 +557,7 @@ namespace JobTrackerApi.Data
// Phase 5.4: append-only cover letter history. JobApplication.CoverLetterText stays the
// current text; this makes every previous state recoverable.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
modelBuilder.Entity<CoverLetterVersion>()
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
// varchar (not longtext) for the indexed columns — see the CvVariant note above.
@@ -600,7 +600,7 @@ namespace JobTrackerApi.Data
.OnDelete(DeleteBehavior.Cascade);
// Phase 5.5: user-owned interview preparation. Unlike InterviewPrepNote (an AI cache), nothing
// regenerates this. docs/architecture/application-workspace.md.
// regenerates this. docs/architecture/overview.md.
modelBuilder.Entity<InterviewPrepItem>()
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
// varchar (not longtext) for the indexed columns — see the CvVariant note above.
@@ -14,7 +14,7 @@ namespace JobTrackerApi.Migrations
// The six CareerProfile child tables were initially provisioned by the reconciler. Explicit
// ownership moved to 20260830133000_AdoptCareerProfileSchema; this historical migration stays
// recorded so existing chains remain compatible.
// docs/infrastructure/database-ownership.md.
// docs/database/migrations.md.
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -14,7 +14,7 @@ namespace JobTrackerApi.Migrations
// CoverLetterVersions is reconciler-owned and provisioned by StartupInitializationExtensions,
// which carries correct DDL per provider and guards the create on JobApplications existing.
// This migration exists only to keep the model snapshot in sync.
// docs/infrastructure/database-ownership.md.
// docs/database/migrations.md.
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -13,7 +13,7 @@ namespace JobTrackerApi.Migrations
//
// InterviewPrepItems is reconciler-owned and provisioned by StartupInitializationExtensions,
// which carries correct DDL per provider and guards the create on JobApplications existing.
// docs/infrastructure/database-ownership.md.
// docs/database/migrations.md.
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
+1 -1
View File
@@ -4,7 +4,7 @@ namespace JobTrackerApi.Models;
// Unlike AiWorkspaceNote (one row per (owner, job, type), overwritten on regenerate — a cache), this
// keeps EVERY generation so the user can restore, compare, reuse, or delete past outputs. Suggestion
// only: an interaction never mutates the master profile, a CV variant, or the application itself.
// docs/architecture/ai-career-assistant.md.
// docs/ai/architecture.md.
public sealed class AiInteraction
{
public int Id { get; set; }
@@ -9,7 +9,7 @@ namespace JobTrackerApi.Models;
// System items carry a stable SystemKey and (usually) an AutoSignal: the same readiness signal the
// /readiness endpoint already computes. When the signal is satisfied the item auto-completes, so the
// checklist and readiness can never disagree — readiness became the calculation, this is the surface.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
public sealed class ApplicationChecklistItem
{
public int Id { get; set; }
+1 -1
View File
@@ -4,7 +4,7 @@ using System.Text.Json;
namespace JobTrackerApi.Models;
// Phase 3: relational children of CareerProfile — the editable master career profile.
// See docs/architecture/career-profile-model.md.
// See docs/architecture/overview.md.
//
// Design notes shared by all child entities:
// - OwnerUserId is denormalized so the tenant global query filter applies directly (same pattern
+1 -1
View File
@@ -12,7 +12,7 @@ public sealed class CareerProfile
// Phase 3: ProfileJson is now a DERIVED projection of the relational children + LongTailJson,
// serialized into the StructuredCvProfile shape and kept in sync on every save so the legacy
// read paths (CV rendering, tailoring, match-score) keep working unchanged. It is no longer an
// independently editable source. See docs/architecture/career-profile-model.md §4.
// independently editable source. See docs/architecture/overview.md.
public string ProfileJson { get; set; } = string.Empty;
// The editable long tail that is not worth a relational table: contact, summary, interests,
+1 -1
View File
@@ -3,7 +3,7 @@ namespace JobTrackerApi.Models;
// A theme is DATA, not code. The renderer (ThemedCvRenderer) has one render path; every visual
// difference between themes is expressed by the fields below. Adding a theme = adding one CvTheme to
// CvThemeCatalog — no renderer changes. This is the core Phase 4 architectural rule
// ("Do NOT hardcode HTML templates"). docs/architecture/cv-theme-engine.md.
// ("Do NOT hardcode HTML templates"). docs/architecture/frontend.md.
public sealed class CvTheme
{
public string Id { get; init; } = string.Empty;
+1 -1
View File
@@ -6,7 +6,7 @@ namespace JobTrackerApi.Models;
// sections show, in what order, with what per-item overrides, rendered through a chosen theme with
// layout/colour/font settings. The career data is never duplicated here — the variant stores only
// selections + overrides keyed by the master profile's stable ItemKeys, plus builder preferences.
// docs/architecture/cv-builder.md.
// docs/architecture/overview.md.
public sealed class CvVariant
{
public int Id { get; set; }
+1 -1
View File
@@ -664,7 +664,7 @@ app.MapControllers();
// this process up and serving?" and nothing else. It does NOT touch the database — a health check
// that queried MariaDB would restart a perfectly healthy backend whenever the database blipped, and
// would also be a free unauthenticated way to probe database availability.
// docs/production-readiness-review.md.
// docs/security/security-notes.md.
// Version comes from configuration (App:Version), which is how docker-compose supplies it as
// App__Version. Reading the APP_VERSION environment variable directly meant /health always
// reported "unknown" in a container. Falls back to the assembly version for local development.
@@ -14,7 +14,7 @@ namespace JobTrackerApi.Services;
//
// The flow is strictly one-directional — CareerProfile -> CvVariant -> application output. Nothing
// here writes upward: no method touches CareerProfile or its children.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
public sealed record ApplicationCvDto(
int? AttachedVariantId,
string? AttachedVariantName,
@@ -12,7 +12,7 @@ namespace JobTrackerApi.Services;
// /readiness endpoint computes, and are re-synced on every read, so "readiness says X is missing" and
// "the checklist says X is pending" cannot drift apart. Readiness keeps its API contract and becomes
// the calculation; the checklist is what the user actually works from and edits.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
public sealed record ChecklistItemDto(
int Id,
string? SystemKey,
@@ -18,7 +18,7 @@ namespace JobTrackerApi.Services;
// The AI narrative is deliberately NOT here: it stays in AiWorkspaceService's "job-analysis" and
// "career-match" modules, which are suggestion-only, append-only (AiInteraction is the version
// history), and require the user to act on them. Nothing in this file writes to the CareerProfile,
// a CvVariant, or the JobApplication. docs/architecture/application-workspace.md.
// a CvVariant, or the JobApplication. docs/architecture/overview.md.
public sealed record JobAnalysisDto(
string? Role,
string? Company,
@@ -10,7 +10,7 @@ namespace JobTrackerApi.Services;
// writes nothing, stores nothing, and adds no table. It turns rows like
// ("StatusChanged", "Applied", "Interview") into a sentence, tags each event with a category and
// whether it is a milestone, and groups the result by day so the workspace can render a real
// timeline instead of a flat list. docs/architecture/application-workspace.md.
// timeline instead of a flat list. docs/architecture/overview.md.
public sealed record TimelineEventDto(
int Id,
string Type,
@@ -9,7 +9,7 @@ namespace JobTrackerApi.Services;
// This is an AGGREGATE READ ONLY. It owns no data and duplicates none: the CV comes from the Phase 4
// CvVariant lens, documents from Attachments, activity from JobEvent, AI history from AiInteraction,
// stage semantics from JobPipeline. Nothing here writes, and no career data is copied.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
public sealed record WorkspaceCvDto(int? VariantId, string? VariantName, string? ThemeId, bool HasTailoredCvText, DateTimeOffset? UpdatedAtUtc);
public sealed record WorkspaceActivityDto(string Type, string? Detail, DateTime At);
public sealed record WorkspaceNextStepDto(string Key, string Label, string Reason, string? Section);
+1 -1
View File
@@ -9,7 +9,7 @@ namespace JobTrackerApi.Services;
// the anonymous /health endpoint. /health used to read the APP_VERSION *environment
// variable* directly, which compose never sets under that name — it passes App__Version,
// binding to the App:Version configuration key. So /health always reported "unknown".
// See docs/release-candidate-review.md (N2).
// See docs/infrastructure/deployment.md for the health/version verification contract.
public static class BuildMetadata
{
// Ignore unresolved shell/compose placeholders that would otherwise leak into the
@@ -6,7 +6,7 @@ namespace JobTrackerApi.Services;
// Phase 3: two-way projection between the relational CareerProfile children and the
// StructuredCvProfile shape (the derived blob + the frontend/AI edit unit).
// See docs/architecture/career-profile-model.md.
// See docs/architecture/overview.md.
//
// Relational holds: Experience, Education, Skill, Project, Certification, Language.
// LongTailJson holds the rest of StructuredCvProfile: Contact, Summary, Interests, OtherSections,
@@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
namespace JobTrackerApi.Services;
// Career Workspace foundation (see docs/career-workspace-implementation-roadmap.md, Phase F1).
// Career Workspace foundation (see docs/roadmap/todo.md).
// Bounded to the profile/CV domain -- job tracking is untouched. Every existing read path still
// goes through ApplicationUser.ProfileCvStructureJson (dual-write window); this service is the
// single place stable item IDs and normalized dates get assigned, and where profile history is
@@ -3,7 +3,7 @@ namespace JobTrackerApi.Services.EmailProviders
/// <summary>
/// Provider-neutral email operations so job correspondence can be sourced from Gmail,
/// Microsoft Graph, generic IMAP, or manual/free-text entry behind a single seam.
/// See docs/remaster/PRODUCT_DIRECTION.md (multi-provider email). Gmail is the first
/// See docs/architecture/integrations.md (multi-provider email). Gmail is the first
/// implementation (<see cref="GmailProvider"/>); the controller migration and additional
/// providers land in follow-up slices.
/// </summary>
@@ -13,7 +13,7 @@ namespace JobTrackerApi.Services;
//
// Follow-ups reuse what already exists: JobApplication.FollowUpAt for the date (RulesEngine and the
// reminder hosted service already act on it) and ApplicationChecklistItem for the task. No second
// reminder system. docs/architecture/application-workspace.md.
// reminder system. docs/architecture/overview.md.
public sealed record InterviewPrepItemDto(
int Id,
string Category,
+1 -1
View File
@@ -11,7 +11,7 @@ namespace JobTrackerApi.Services;
//
// Events are derived from the TRANSITION, not from the resulting state, so one user action produces
// at most one lifecycle event and re-saving an unchanged status produces none.
// docs/architecture/application-workspace.md.
// docs/architecture/overview.md.
public static class JobLifecycleEvents
{
/// <summary>
@@ -121,7 +121,7 @@ public static class StartupInitializationExtensions
// migration-owned tables do not exist yet. Repairing an absent table is not this pass's job --
// it is skipped, Migrate() creates it, and the post-Migrate pass then finds it and reconciles.
// Without this guard a clean MariaDB install died on "Table 'CareerProfiles' doesn't exist".
// See docs/infrastructure/database-ownership.md.
// See docs/database/migrations.md.
private static void EnsureMySqlIndex(DbConnection c, string table, string indexName, string columnsSql, bool unique = false)
{
if (!HasMySqlTable(c, table)) return;
@@ -276,7 +276,7 @@ public static class StartupInitializationExtensions
// the migration-created tables and finishes compatibility repair.
//
// Every statement in here is existence-guarded, so running it twice is a no-op scan on an
// already-correct database. docs/infrastructure/database-ownership.md.
// already-correct database. docs/database/migrations.md.
void ReconcileSchema()
{
if (useSqliteBootstrap)
+1 -1
View File
@@ -15,7 +15,7 @@ public interface IThemedCvRenderer
// ONE render path for every theme. The theme (data) drives layout, palette, typography and spacing;
// the variant settings apply a few runtime overrides (accent, fonts, density, page size, photo,
// icons, page numbers). Adding a theme never touches this file. docs/architecture/cv-theme-engine.md.
// icons, page numbers). Adding a theme never touches this file. docs/architecture/frontend.md.
public sealed class ThemedCvRenderer : IThemedCvRenderer
{
public ThemedCvRenderResult Render(CvRenderModel model, CvTheme theme, CvVariantSettings settings)