diff --git a/aidlc-docs/features/media-library/assumptions-and-open-questions.md b/aidlc-docs/features/media-library/assumptions-and-open-questions.md
index 72a649e..2341bd3 100644
--- a/aidlc-docs/features/media-library/assumptions-and-open-questions.md
+++ b/aidlc-docs/features/media-library/assumptions-and-open-questions.md
@@ -80,3 +80,4 @@ Kept while Bryan is away (2026-11-17): no questions to him, a most probable assu
| 49 | **Compact tiles in the clean-up and the delete confirmation** (product owner request, 2026-11-17). | `PhotoSelectionList` has a third layout `compact` (3/4/6/8 columns, square small thumbnails, name and a short usage line on one truncated line each, full name, date, size and usage in the tooltip; checkbox chip, whole-tile select, select all and the bulk bar unchanged). The clean-up dialog uses it. The "places that lose the photo" list in the second step of `DeleteDialog` is a read-only compact grid of the same kind. `PurgeDialog` shows no photo list (only a count), so it is unchanged; the library tiles and the ImagePicker are unchanged. | Long row lists again in the dialogs (much scrolling, little overview). | `PhotoSelectionList.tsx` (`layout="compact"`), `CleanupDialog.tsx`, `DeleteDialog.tsx` (`delete-places`) |
| 50 | **Step C reads the library screen's data from the library tables, not the hero admin** (2026-11-17). | The read switch (`off`/`compare`/`on`) changes where the library screen gets photos, trash and uses; the hero's admin and public endpoints keep their own tables because they need the variants, which move in phase 3. Thumbnails come from the hero. `compare` only logs and reports (`GET media-library/read-check`); `on` falls back to the hero's tables when the library cannot be read. | Serve the hero admin from the library too: needs the variants (and cut sets) in the library tables first. | `HeroMediaUsageProvider`, `IMediaLibraryReader`, `MediaLibraryReader`, `MediaReadComparer` |
| 51 | **"Controle bibliotheek" panel in the library screen** (SLS-Main for Bryan, 2026-11-17). | A small panel under the storage meter, for administrators (the whole screen is admin only), asks `GET media-library/read-check` only when its button is clicked and says in plain words (nl/en) whether the library tables match each module or lists the differences, plus the state of the three switches (copy, write-through, reading off/compare/on; the response now carries `copyOnStartup` and `dualWrite`). It changes nothing. Always shown, not only on test. | Show it only when the read switch is not off: Bryan could then not check before switching. | `LibraryCheck.tsx`, `MediaLibraryController.ReadCheck`, `IMediaLibrarySwitchState` |
+| 52 | **Phase 3a: the library tables hold what the hero needs to publish** (2026-11-18). | Additive migration `AddHeroPhotoColumns` of the Media module: `MediaAssets.SetHash`, `MediaAssets.Variants` (the module's own JSON), the wide/tall overrides of the photo's crop, and `MediaUses.Variants`. The copy, the write-through and the verification fill and compare them; the read check shows a difference in them. Nothing reads them to publish yet (that is 3b). | Store the variants relationally: more tables for no gain while only the hero publishes from here. | `MediaEntities`, `MediaLibraryCopier`, `HeroMediaMigrationSource` |
diff --git a/src/SlpModularCms.Core/Media/Library/MediaLibraryReader.cs b/src/SlpModularCms.Core/Media/Library/MediaLibraryReader.cs
index c4a5b40..3abbb9d 100644
--- a/src/SlpModularCms.Core/Media/Library/MediaLibraryReader.cs
+++ b/src/SlpModularCms.Core/Media/Library/MediaLibraryReader.cs
@@ -86,6 +86,11 @@ public static class MediaReadComparer
differences.Add($"photo {own.Id}: hash, key or size differs");
}
+ if (own.SetHash != copy.SetHash || own.VariantsJson != copy.VariantsJson)
+ {
+ differences.Add($"photo {own.Id}: set hash or variants differ");
+ }
+
if ((own.DeletedAt is null) != (copy.DeletedAt is null))
{
differences.Add($"photo {own.Id}: trash state differs");
@@ -113,7 +118,7 @@ public static class MediaReadComparer
continue;
}
- if (own.AssetId != copy.AssetId || own.Position != copy.Position || own.Active != copy.Active || own.SetHash != copy.SetHash)
+ if (own.AssetId != copy.AssetId || own.Position != copy.Position || own.Active != copy.Active || own.SetHash != copy.SetHash || own.VariantsJson != copy.VariantsJson)
{
differences.Add($"use {own.Id}: photo, position, active flag or set hash differs");
}
diff --git a/src/SlpModularCms.Core/Media/Library/MediaMigrationTypes.cs b/src/SlpModularCms.Core/Media/Library/MediaMigrationTypes.cs
index 4935268..0a7eea6 100644
--- a/src/SlpModularCms.Core/Media/Library/MediaMigrationTypes.cs
+++ b/src/SlpModularCms.Core/Media/Library/MediaMigrationTypes.cs
@@ -7,6 +7,8 @@ public sealed record MediaCropSnapshot(string Ratio, double X, double Y, double
/// A photo as a module holds it today, for copying into the library's own tables. Same ids, hashes and set hashes as the
/// module uses, so no public address changes (migration plan, decision 13).
///
+// Phase 3: the snapshots also carry what the module needs to publish the photo from the library tables: the variants of the
+// current set (opaque JSON, the module's own format) and the wide and tall overrides of the photo's crop (null = none).
public sealed record MediaAssetSnapshot(
Guid Id,
string Module,
@@ -25,10 +27,17 @@ public sealed record MediaAssetSnapshot(
Guid CreatedByUserId,
string? OriginalFileName,
DateTimeOffset? LastUsedAt,
- DateTimeOffset? DeletedAt);
+ DateTimeOffset? DeletedAt,
+ string? VariantsJson = null,
+ double? WideFocusX = null,
+ double? WideFocusY = null,
+ double? WideZoom = null,
+ double? TallFocusX = null,
+ double? TallFocusY = null,
+ double? TallZoom = null);
/// One place a photo is used, as a module holds it today. Crops are the crops of THIS use (crop per use); null = the crops of its photo.
-public sealed record MediaUseSnapshot(Guid Id, Guid AssetId, string Module, string PlaceKind, int Position, bool Active, string SetHash, IReadOnlyList? Crops = null);
+public sealed record MediaUseSnapshot(Guid Id, Guid AssetId, string Module, string PlaceKind, int Position, bool Active, string SetHash, IReadOnlyList? Crops = null, string? VariantsJson = null);
///
/// What a module offers so the library can copy its photos and uses into its own tables. Read-only: the module's data is
diff --git a/src/SlpModularCms.Modules.Hero.Tests/HeroLibrarySyncTests.cs b/src/SlpModularCms.Modules.Hero.Tests/HeroLibrarySyncTests.cs
index 0a3e8c5..4bd3a7f 100644
--- a/src/SlpModularCms.Modules.Hero.Tests/HeroLibrarySyncTests.cs
+++ b/src/SlpModularCms.Modules.Hero.Tests/HeroLibrarySyncTests.cs
@@ -1,6 +1,7 @@
using FluentAssertions;
using NSubstitute;
using SlpModularCms.Core.Media.Library;
+using SlpModularCms.Modules.Hero.Data.Entities;
using SlpModularCms.Modules.Hero.Models;
using SlpModularCms.Modules.Hero.Services;
using Xunit;
@@ -73,4 +74,21 @@ public class HeroLibrarySyncTests
second.Crops.Should().NotBeNull();
second.Crops!.Single(c => c.Ratio == "wide").X.Should().BeApproximately(0.1, 0.0001);
}
+ [Fact]
+ public async Task The_migration_source_gives_the_variants_in_the_format_the_hero_stores_them_and_the_overrides_of_the_crop()
+ {
+ using var rig = new HeroTestRig();
+ var image = await rig.Upload(HeroTestRig.Photo());
+ var id = Guid.Parse(image.Id);
+ await rig.Images.SetFocusAsync(id, new HeroFocusRequest(new FocusDto(0.5, 0.5, 1), new FocusDto(0.2, 0.3, 1.5), null), HeroTestRig.Admin, CancellationToken.None);
+ await rig.RenderPending();
+
+ var asset = (await new HeroMediaMigrationSource(rig.Repository).ListAssetsAsync(CancellationToken.None)).Single();
+
+ var stored = rig.Db.HeroImages.Single(i => i.Id == id);
+ asset.SetHash.Should().Be(stored.SetHash);
+ System.Text.Json.JsonSerializer.Deserialize>(asset.VariantsJson!).Should().Equal(stored.Variants);
+ (asset.WideFocusX, asset.WideFocusY, asset.WideZoom).Should().Be((0.2, 0.3, 1.5));
+ (asset.TallFocusX, asset.TallFocusY, asset.TallZoom).Should().Be((null, null, null));
+ }
}
diff --git a/src/SlpModularCms.Modules.Hero/Services/HeroMediaMigrationSource.cs b/src/SlpModularCms.Modules.Hero/Services/HeroMediaMigrationSource.cs
index 0887bce..fd2adcc 100644
--- a/src/SlpModularCms.Modules.Hero/Services/HeroMediaMigrationSource.cs
+++ b/src/SlpModularCms.Modules.Hero/Services/HeroMediaMigrationSource.cs
@@ -40,7 +40,8 @@ public class HeroMediaMigrationSource(IHeroRepository repository) : IMediaMigrat
}
}
- uses.Add(new MediaUseSnapshot(slide.Id, slide.ImageId, Module, HeroMediaUsageProvider.SlideKind, index + 1, slide.IsActive, setHash, crops));
+ var variantsJson = slide.HasOwnCrop && slide.Variants is { Count: > 0 } ? Json(slide.Variants) : null;
+ uses.Add(new MediaUseSnapshot(slide.Id, slide.ImageId, Module, HeroMediaUsageProvider.SlideKind, index + 1, slide.IsActive, setHash, crops, variantsJson));
}
}
@@ -66,7 +67,17 @@ public class HeroMediaMigrationSource(IHeroRepository repository) : IMediaMigrat
i.CreatedByUserId,
i.OriginalFileName,
i.LastUsedAt,
- i.DeletedAt);
+ i.DeletedAt,
+ Json(i.Variants),
+ i.WideFocusX,
+ i.WideFocusY,
+ i.WideZoom,
+ i.TallFocusX,
+ i.TallFocusY,
+ i.TallZoom);
+
+ /// The variants as the hero stores them (the same serializer as its database column), so they can go back unchanged.
+ public static string Json(IEnumerable variants) => System.Text.Json.JsonSerializer.Serialize(variants.ToList(), (System.Text.Json.JsonSerializerOptions?)null);
private static MediaCropSnapshot Crop(string ratio, HeroImage image)
{
diff --git a/src/SlpModularCms.Modules.Media.Tests/MediaLibraryCopierTests.cs b/src/SlpModularCms.Modules.Media.Tests/MediaLibraryCopierTests.cs
index 700656a..234415f 100644
--- a/src/SlpModularCms.Modules.Media.Tests/MediaLibraryCopierTests.cs
+++ b/src/SlpModularCms.Modules.Media.Tests/MediaLibraryCopierTests.cs
@@ -112,4 +112,19 @@ public class MediaLibraryCopierTests : IDisposable
report.Assets.Should().Be(2);
report.Uses.Should().Be(1);
}
+ [Fact]
+ public async Task Copies_and_verifies_the_variants_the_set_hash_and_the_crop_overrides_of_a_photo_and_of_a_use()
+ {
+ var variants = "[{\"Ratio\":\"wide\",\"Width\":480,\"Height\":270,\"Type\":\"image/webp\",\"FileName\":\"wide-480.webp\",\"Bytes\":1234}]";
+ var a = Asset() with { VariantsJson = variants, WideFocusX = 0.1, WideFocusY = 0.2, WideZoom = 1.3, TallFocusX = 0.7 };
+ var use = Use(a) with { VariantsJson = variants, SetHash = "fedcba9876543210" };
+
+ await Copier(new Source("hero", [a], [use])).CopyAsync(CancellationToken.None);
+
+ var photo = await _db.MediaAssets.SingleAsync();
+ photo.Variants.Should().Be(variants);
+ photo.SetHash.Should().Be(a.SetHash);
+ (photo.WideFocusX, photo.WideFocusY, photo.WideZoom, photo.TallFocusX, photo.TallFocusY).Should().Be((0.1, 0.2, 1.3, 0.7, null));
+ (await _db.MediaUses.SingleAsync()).Variants.Should().Be(variants);
+ }
}
diff --git a/src/SlpModularCms.Modules.Media.Tests/MediaLibraryReaderTests.cs b/src/SlpModularCms.Modules.Media.Tests/MediaLibraryReaderTests.cs
index 5736239..8a71e44 100644
--- a/src/SlpModularCms.Modules.Media.Tests/MediaLibraryReaderTests.cs
+++ b/src/SlpModularCms.Modules.Media.Tests/MediaLibraryReaderTests.cs
@@ -67,4 +67,19 @@ public class MediaLibraryReaderTests : IDisposable
differences.Should().Contain(d => d.StartsWith("use ") && d.Contains("differs"));
differences.Should().Contain(d => d.Contains(ghost.Id.ToString()));
}
+ [Fact]
+ public async Task Reads_back_the_variants_and_set_hash_and_the_comparer_notices_a_difference_in_them()
+ {
+ var hero = Asset("hero") with { VariantsJson = "[{\"Ratio\":\"wide\"}]", WideFocusX = 0.3 };
+ await new MediaLibraryCopier(_db, [new Source("hero", [hero], [])], NullLogger.Instance).CopyAsync(CancellationToken.None);
+ var reader = new MediaLibraryReader(_db, Options.Create(new MediaLibraryOptions()));
+
+ var back = (await reader.ListAssetsAsync("hero", CancellationToken.None)).Single();
+
+ back.VariantsJson.Should().Be(hero.VariantsJson);
+ back.SetHash.Should().Be(hero.SetHash);
+ back.WideFocusX.Should().Be(0.3);
+ MediaReadComparer.Compare([hero], [], [back], []).Should().BeEmpty();
+ MediaReadComparer.Compare([hero with { VariantsJson = "[]" }], [], [back], []).Should().Contain(d => d.Contains("set hash or variants differ"));
+ }
}
diff --git a/src/SlpModularCms.Modules.Media/Data/Entities/MediaEntities.cs b/src/SlpModularCms.Modules.Media/Data/Entities/MediaEntities.cs
index b99fd79..00df410 100644
--- a/src/SlpModularCms.Modules.Media/Data/Entities/MediaEntities.cs
+++ b/src/SlpModularCms.Modules.Media/Data/Entities/MediaEntities.cs
@@ -24,6 +24,17 @@ public class MediaAsset
public double DefaultFocusY { get; set; } = 0.5;
public double DefaultZoom { get; set; } = 1.0;
+ // Phase 3: what the owning module needs to publish the photo from here. The overrides of the photo's crop per ratio
+ // (null = the default crop), the hash of the current set and its variants as the module's own JSON.
+ public double? WideFocusX { get; set; }
+ public double? WideFocusY { get; set; }
+ public double? WideZoom { get; set; }
+ public double? TallFocusX { get; set; }
+ public double? TallFocusY { get; set; }
+ public double? TallZoom { get; set; }
+ public string? SetHash { get; set; }
+ public string? Variants { get; set; }
+
public DateTimeOffset CreatedAt { get; set; }
public Guid CreatedByUserId { get; set; }
public string? OriginalFileName { get; set; }
@@ -56,4 +67,7 @@ public class MediaAssetUse
/// The crops of this use as JSON: [{ratio, x, y, zoom}]. Empty for a natural-ratio use.
public string Crops { get; set; } = "[]";
+
+ /// Phase 3: the variants of this use's own set as the module's own JSON (null = the photo's).
+ public string? Variants { get; set; }
}
diff --git a/src/SlpModularCms.Modules.Media/Data/MediaDbContext.cs b/src/SlpModularCms.Modules.Media/Data/MediaDbContext.cs
index 3f85b1d..7ac4c60 100644
--- a/src/SlpModularCms.Modules.Media/Data/MediaDbContext.cs
+++ b/src/SlpModularCms.Modules.Media/Data/MediaDbContext.cs
@@ -22,6 +22,8 @@ public class MediaDbContext(DbContextOptions options) : DbContex
entity.Property(e => e.OriginalKey).IsRequired().HasMaxLength(200);
entity.Property(e => e.SourceFormat).IsRequired().HasMaxLength(10);
entity.Property(e => e.OriginalFileName).HasMaxLength(200);
+ entity.Property(e => e.SetHash).HasMaxLength(16);
+ entity.Property(e => e.Variants).HasColumnType("longtext");
entity.HasIndex(e => e.CreatedAt);
entity.HasMany(e => e.Uses).WithOne(u => u.Asset).HasForeignKey(u => u.AssetId).OnDelete(DeleteBehavior.Cascade);
});
@@ -34,6 +36,7 @@ public class MediaDbContext(DbContextOptions options) : DbContex
entity.Property(e => e.PlaceKind).IsRequired().HasMaxLength(20);
entity.Property(e => e.SetHash).IsRequired().HasMaxLength(16);
entity.Property(e => e.Crops).IsRequired().HasColumnType("longtext");
+ entity.Property(e => e.Variants).HasColumnType("longtext");
entity.HasIndex(e => e.AssetId);
});
}
diff --git a/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.Designer.cs b/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.Designer.cs
new file mode 100644
index 0000000..2e16b41
--- /dev/null
+++ b/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.Designer.cs
@@ -0,0 +1,182 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SlpModularCms.Modules.Media.Data;
+
+#nullable disable
+
+namespace SlpModularCms.Modules.Media.Migrations
+{
+ [DbContext(typeof(MediaDbContext))]
+ [Migration("20261117225718_AddHeroPhotoColumns")]
+ partial class AddHeroPhotoColumns
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "10.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("SlpModularCms.Modules.Media.Data.Entities.MediaAsset", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("Bytes")
+ .HasColumnType("bigint");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime");
+
+ b.Property("CreatedByUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("DefaultFocusX")
+ .HasColumnType("double");
+
+ b.Property("DefaultFocusY")
+ .HasColumnType("double");
+
+ b.Property("DefaultZoom")
+ .HasColumnType("double");
+
+ b.Property("DeletedAt")
+ .HasColumnType("datetime");
+
+ b.Property("Height")
+ .HasColumnType("int");
+
+ b.Property("LastUsedAt")
+ .HasColumnType("datetime");
+
+ b.Property("Module")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)");
+
+ b.Property("OriginalFileName")
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)");
+
+ b.Property("OriginalKey")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)");
+
+ b.Property("OriginalSha256")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("SetHash")
+ .HasMaxLength(16)
+ .HasColumnType("varchar(16)");
+
+ b.Property("SourceFormat")
+ .IsRequired()
+ .HasMaxLength(10)
+ .HasColumnType("varchar(10)");
+
+ b.Property("TallFocusX")
+ .HasColumnType("double");
+
+ b.Property("TallFocusY")
+ .HasColumnType("double");
+
+ b.Property("TallZoom")
+ .HasColumnType("double");
+
+ b.Property("Variants")
+ .HasColumnType("longtext");
+
+ b.Property("WideFocusX")
+ .HasColumnType("double");
+
+ b.Property("WideFocusY")
+ .HasColumnType("double");
+
+ b.Property("WideZoom")
+ .HasColumnType("double");
+
+ b.Property("Width")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatedAt");
+
+ b.HasIndex("OriginalSha256")
+ .IsUnique();
+
+ b.ToTable("MediaAssets", (string)null);
+ });
+
+ modelBuilder.Entity("SlpModularCms.Modules.Media.Data.Entities.MediaAssetUse", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("Active")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("AssetId")
+ .HasColumnType("char(36)");
+
+ b.Property("Crops")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Module")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)");
+
+ b.Property("PlaceKind")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)");
+
+ b.Property("Position")
+ .HasColumnType("int");
+
+ b.Property("SetHash")
+ .IsRequired()
+ .HasMaxLength(16)
+ .HasColumnType("varchar(16)");
+
+ b.Property("Variants")
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AssetId");
+
+ b.ToTable("MediaUses", (string)null);
+ });
+
+ modelBuilder.Entity("SlpModularCms.Modules.Media.Data.Entities.MediaAssetUse", b =>
+ {
+ b.HasOne("SlpModularCms.Modules.Media.Data.Entities.MediaAsset", "Asset")
+ .WithMany("Uses")
+ .HasForeignKey("AssetId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Asset");
+ });
+
+ modelBuilder.Entity("SlpModularCms.Modules.Media.Data.Entities.MediaAsset", b =>
+ {
+ b.Navigation("Uses");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.cs b/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.cs
new file mode 100644
index 0000000..2d20a9e
--- /dev/null
+++ b/src/SlpModularCms.Modules.Media/Migrations/20261117225718_AddHeroPhotoColumns.cs
@@ -0,0 +1,109 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SlpModularCms.Modules.Media.Migrations
+{
+ ///
+ public partial class AddHeroPhotoColumns : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "Variants",
+ table: "MediaUses",
+ type: "longtext",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "SetHash",
+ table: "MediaAssets",
+ type: "varchar(16)",
+ maxLength: 16,
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "TallFocusX",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "TallFocusY",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "TallZoom",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "Variants",
+ table: "MediaAssets",
+ type: "longtext",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "WideFocusX",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "WideFocusY",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "WideZoom",
+ table: "MediaAssets",
+ type: "double",
+ nullable: true);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "Variants",
+ table: "MediaUses");
+
+ migrationBuilder.DropColumn(
+ name: "SetHash",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "TallFocusX",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "TallFocusY",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "TallZoom",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "Variants",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "WideFocusX",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "WideFocusY",
+ table: "MediaAssets");
+
+ migrationBuilder.DropColumn(
+ name: "WideZoom",
+ table: "MediaAssets");
+ }
+ }
+}
diff --git a/src/SlpModularCms.Modules.Media/Migrations/MediaDbContextModelSnapshot.cs b/src/SlpModularCms.Modules.Media/Migrations/MediaDbContextModelSnapshot.cs
index 1d7f5b3..a4f6571 100644
--- a/src/SlpModularCms.Modules.Media/Migrations/MediaDbContextModelSnapshot.cs
+++ b/src/SlpModularCms.Modules.Media/Migrations/MediaDbContextModelSnapshot.cs
@@ -71,11 +71,36 @@ namespace SlpModularCms.Modules.Media.Migrations
.HasMaxLength(64)
.HasColumnType("varchar(64)");
+ b.Property("SetHash")
+ .HasMaxLength(16)
+ .HasColumnType("varchar(16)");
+
b.Property("SourceFormat")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("varchar(10)");
+ b.Property("TallFocusX")
+ .HasColumnType("double");
+
+ b.Property("TallFocusY")
+ .HasColumnType("double");
+
+ b.Property("TallZoom")
+ .HasColumnType("double");
+
+ b.Property("Variants")
+ .HasColumnType("longtext");
+
+ b.Property("WideFocusX")
+ .HasColumnType("double");
+
+ b.Property("WideFocusY")
+ .HasColumnType("double");
+
+ b.Property("WideZoom")
+ .HasColumnType("double");
+
b.Property("Width")
.HasColumnType("int");
@@ -123,6 +148,9 @@ namespace SlpModularCms.Modules.Media.Migrations
.HasMaxLength(16)
.HasColumnType("varchar(16)");
+ b.Property("Variants")
+ .HasColumnType("longtext");
+
b.HasKey("Id");
b.HasIndex("AssetId");
diff --git a/src/SlpModularCms.Modules.Media/Services/MediaLibraryCopier.cs b/src/SlpModularCms.Modules.Media/Services/MediaLibraryCopier.cs
index de80e39..418dfca 100644
--- a/src/SlpModularCms.Modules.Media/Services/MediaLibraryCopier.cs
+++ b/src/SlpModularCms.Modules.Media/Services/MediaLibraryCopier.cs
@@ -122,6 +122,10 @@ public sealed class MediaLibraryCopier(MediaDbContext db, IEnumerable (await db.MediaAssets.AsNoTracking().Where(a => a.Module == module).ToListAsync(cancellationToken))
.Select(a => new MediaAssetSnapshot(
a.Id, a.Module, a.OriginalSha256, a.OriginalKey, a.SourceFormat, a.Width, a.Height, a.Bytes,
- a.DefaultFocusX, a.DefaultFocusY, a.DefaultZoom, string.Empty, [], a.CreatedAt, a.CreatedByUserId, a.OriginalFileName, a.LastUsedAt, a.DeletedAt))
+ a.DefaultFocusX, a.DefaultFocusY, a.DefaultZoom, a.SetHash ?? string.Empty, [], a.CreatedAt, a.CreatedByUserId, a.OriginalFileName, a.LastUsedAt, a.DeletedAt,
+ a.Variants, a.WideFocusX, a.WideFocusY, a.WideZoom, a.TallFocusX, a.TallFocusY, a.TallZoom))
.ToList();
public async Task> ListUsesAsync(string module, CancellationToken cancellationToken)
=> (await db.MediaUses.AsNoTracking().Where(u => u.Module == module).ToListAsync(cancellationToken))
- .Select(u => new MediaUseSnapshot(u.Id, u.AssetId, u.Module, u.PlaceKind, u.Position, u.Active, u.SetHash))
+ .Select(u => new MediaUseSnapshot(u.Id, u.AssetId, u.Module, u.PlaceKind, u.Position, u.Active, u.SetHash, null, u.Variants))
.ToList();
}