CDN flag change
This commit is contained in:
@@ -25,6 +25,7 @@ public sealed class CatalogDbContext : DbContext
|
||||
public DbSet<CardDefinition> CardDefinitions => Set<CardDefinition>();
|
||||
public DbSet<CardAsset> CardAssets => Set<CardAsset>();
|
||||
public DbSet<CardAnimationBinding> AnimationBindings => Set<CardAnimationBinding>();
|
||||
public DbSet<CdnUploadRecord> CdnUploadRecords => Set<CdnUploadRecord>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@@ -114,5 +115,17 @@ public sealed class CatalogDbContext : DbContext
|
||||
// One action name per card — no duplicate "attack" bindings.
|
||||
e.HasIndex(a => new { a.CardDefinitionId, a.ActionName }).IsUnique();
|
||||
});
|
||||
|
||||
builder.Entity<CdnUploadRecord>(e =>
|
||||
{
|
||||
e.ToTable("cdn_upload_records");
|
||||
e.HasKey(r => r.Id);
|
||||
e.Property(r => r.ObjectKey).IsRequired();
|
||||
e.Property(r => r.Prefix).IsRequired();
|
||||
e.Property(r => r.PublicUrl).IsRequired();
|
||||
e.HasIndex(r => r.ObjectKey).IsUnique();
|
||||
e.HasIndex(r => r.Prefix);
|
||||
e.HasIndex(r => r.IsAiGenerated);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace SOR.Database.Entities.Catalog;
|
||||
|
||||
/// <summary>
|
||||
/// Tracks generic CDN uploads made through the admin portal.
|
||||
/// This is separate from card-linked asset records so arbitrary files
|
||||
/// (UI graphics, config data, music, SFX, models, etc.) can still carry
|
||||
/// provenance metadata such as whether they were AI-generated.
|
||||
/// </summary>
|
||||
public sealed class CdnUploadRecord
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>S3 object key within the configured bucket.</summary>
|
||||
public string ObjectKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Logical top-level or nested folder prefix, e.g. "graphics" or "models/ui".</summary>
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Publicly accessible CDN URL for the uploaded object.</summary>
|
||||
public string PublicUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Best-known MIME type for the object.</summary>
|
||||
public string? ContentType { get; set; }
|
||||
|
||||
/// <summary>Whether the object was AI-generated.</summary>
|
||||
public bool IsAiGenerated { get; set; }
|
||||
|
||||
public DateTimeOffset UploadedAt { get; set; }
|
||||
}
|
||||
@@ -23,14 +23,14 @@ public enum Affinity
|
||||
// ── Standard non-basic (two-basic combinations) ───────────────────────
|
||||
Ocean, // Lake + Lake
|
||||
Island, // Lake + Hill
|
||||
Marsh, // Lake + Forest
|
||||
Swamp, // Lake + Field
|
||||
Marsh, // Lake + Field
|
||||
Swamp, // Lake + Forest
|
||||
Mountain, // Hill + Hill
|
||||
Steppe, // Hill + Forest
|
||||
Fort, // Hill + Field
|
||||
Plains, // Forest + Field
|
||||
Grove, // Forest + Forest
|
||||
Jungle, // Field + Field
|
||||
Steppe, // Field + Forest
|
||||
Fort, // Hill + forest
|
||||
Plains, // Field + Field
|
||||
Grove, // Field + Forest
|
||||
Jungle, // Forest + Forest
|
||||
|
||||
// ── Aether combinations ───────────────────────────────────────────────
|
||||
UnstableAether, // Aether + any non-Aether (tile-only, cannot appear on cards)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCdnUploadRecords : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "cdn_upload_records",
|
||||
schema: "catalog",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
ObjectKey = table.Column<string>(type: "text", nullable: false),
|
||||
Prefix = table.Column<string>(type: "text", nullable: false),
|
||||
PublicUrl = table.Column<string>(type: "text", nullable: false),
|
||||
ContentType = table.Column<string>(type: "text", nullable: true),
|
||||
IsAiGenerated = table.Column<bool>(type: "boolean", nullable: false),
|
||||
UploadedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_cdn_upload_records", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdn_upload_records_IsAiGenerated",
|
||||
schema: "catalog",
|
||||
table: "cdn_upload_records",
|
||||
column: "IsAiGenerated");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdn_upload_records_ObjectKey",
|
||||
schema: "catalog",
|
||||
table: "cdn_upload_records",
|
||||
column: "ObjectKey",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_cdn_upload_records_Prefix",
|
||||
schema: "catalog",
|
||||
table: "cdn_upload_records",
|
||||
column: "Prefix");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "cdn_upload_records",
|
||||
schema: "catalog");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,45 @@ namespace SOR.Database.Migrations.Catalog
|
||||
b.ToTable("card_definitions", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ContentType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ObjectKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UploadedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsAiGenerated");
|
||||
|
||||
b.HasIndex("ObjectKey")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Prefix");
|
||||
|
||||
b.ToTable("cdn_upload_records", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
||||
Reference in New Issue
Block a user