f299d7be7c
Phase 5 backend. A unified AI Workspace for each application, orchestrating the
five suggestion modules through the existing ISummarizerService provider
abstraction and storing every generation as append-only history (AiInteraction)
so outputs can be reused, compared, and deleted — distinct from the existing
AiWorkspaceNote cache (one row, overwritten).
Modules (all suggestion-only, "never invent facts" guardrail, never mutate the
profile/variant/application): job-analysis, career-match, cover-letter (6 modes),
interview, application-review. Each builds a prompt from the job + master profile
text and returns markdown.
- Models/AiInteraction.cs + migration AddAiInteractions (verified on container)
- Services/AiWorkspaceService.cs (prompts, history, delete)
- Controllers/AiWorkspaceController.cs (/api/jobapplications/{id}/ai:
generate, history, delete, modules+provider)
- 7 tests (store, history filter/order, delete, mode normalization, unknown
module, empty output, tenant scoping); 306 backend green
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace JobTrackerApi.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddAiInteractions : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AiInteractions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
OwnerUserId = table.Column<string>(type: "TEXT", nullable: false),
|
|
JobApplicationId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Module = table.Column<string>(type: "TEXT", nullable: false),
|
|
Mode = table.Column<string>(type: "TEXT", nullable: true),
|
|
Title = table.Column<string>(type: "TEXT", nullable: false),
|
|
Provider = table.Column<string>(type: "TEXT", nullable: false),
|
|
ResultJson = table.Column<string>(type: "TEXT", nullable: false),
|
|
CreatedAtUtc = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AiInteractions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AiInteractions_JobApplications_JobApplicationId",
|
|
column: x => x.JobApplicationId,
|
|
principalTable: "JobApplications",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AiInteractions_JobApplicationId",
|
|
table: "AiInteractions",
|
|
column: "JobApplicationId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AiInteractions_OwnerUserId_JobApplicationId_Module_CreatedAtUtc",
|
|
table: "AiInteractions",
|
|
columns: new[] { "OwnerUserId", "JobApplicationId", "Module", "CreatedAtUtc" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AiInteractions");
|
|
}
|
|
}
|
|
}
|