refactor: contain backend feature mappings
Some checks failed
Backend CI/CD / build_and_deploy (push) Has been cancelled
Frontend CI/CD / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 01:14:01 -04:00
parent 121757546a
commit 20f8a14bfb
10 changed files with 308 additions and 190 deletions

View File

@@ -0,0 +1,40 @@
namespace Socialize.Modules.Assets.Data;
public static class AssetModelConfiguration
{
public static ModelBuilder ConfigureAssetsModule(this ModelBuilder modelBuilder)
{
modelBuilder.Entity<Asset>(asset =>
{
asset.ToTable("Assets");
asset.HasKey(x => x.Id);
asset.Property(x => x.AssetType).HasMaxLength(64).IsRequired();
asset.Property(x => x.SourceType).HasMaxLength(64).IsRequired();
asset.Property(x => x.DisplayName).HasMaxLength(256).IsRequired();
asset.Property(x => x.GoogleDriveFileId).HasMaxLength(256);
asset.Property(x => x.GoogleDriveLink).HasMaxLength(2048);
asset.Property(x => x.PreviewUrl).HasMaxLength(2048);
asset.Property(x => x.CreatedAt)
.ValueGeneratedOnAdd()
.HasDefaultValueSql("CURRENT_TIMESTAMP");
asset.HasIndex(x => x.WorkspaceId);
asset.HasIndex(x => x.ContentItemId);
});
modelBuilder.Entity<AssetRevision>(revision =>
{
revision.ToTable("AssetRevisions");
revision.HasKey(x => x.Id);
revision.Property(x => x.SourceReference).HasMaxLength(2048).IsRequired();
revision.Property(x => x.PreviewUrl).HasMaxLength(2048);
revision.Property(x => x.Notes).HasMaxLength(1024);
revision.Property(x => x.CreatedAt)
.ValueGeneratedOnAdd()
.HasDefaultValueSql("CURRENT_TIMESTAMP");
revision.HasIndex(x => x.AssetId);
revision.HasIndex(x => new { x.AssetId, x.RevisionNumber }).IsUnique();
});
return modelBuilder;
}
}