feat(ai): centralize durable usage
CI and Deploy / test (pull_request) Successful in 5m19s
CI and Deploy / deploy (pull_request) Has been skipped

Add a content-free usage ledger with legacy backfill. Reserve Workspace and durable Strategy/CV work before execution so deleted history or duplicate admission cannot reset limits.
This commit is contained in:
cesnimda
2026-08-15 20:03:06 +02:00
parent dbff0f8d49
commit 134aac7bcf
28 changed files with 3539 additions and 83 deletions
@@ -182,6 +182,57 @@ namespace JobTrackerApi.Migrations
b.ToTable("AiInteractions");
});
modelBuilder.Entity("JobTrackerApi.Models.AiUsageRecord", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CallCount")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset>("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property<int>("EstimatedTokenCount")
.HasColumnType("INTEGER");
b.Property<int>("InputCharacterCount")
.HasColumnType("INTEGER");
b.Property<int>("OutputCharacterCount")
.HasColumnType("INTEGER");
b.Property<string>("OwnerUserId")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("SourceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.Property<string>("SourceType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<string>("TaskType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("OwnerUserId", "CreatedAtUtc");
b.HasIndex("OwnerUserId", "SourceType", "SourceId")
.IsUnique();
b.ToTable("AiUsageRecords");
});
modelBuilder.Entity("JobTrackerApi.Models.AiWorkspaceNote", b =>
{
b.Property<int>("Id")