Phase 9 Wave 1: add ReleaseMedium discriminator + Session/Mix metadata

Add ReleaseMedium enum (Cut/Session/Mix) and two 1:1 satellite entities
(SessionMetadata, MixMetadata) with EF configs and an additive migration.
ReleaseDto.ReleaseType is now nullable, nulled for non-Cut at the converter.
Existing releases default to Cut via column default; no data migration.
This commit is contained in:
daniel-c-harvey
2026-06-12 21:47:04 -04:00
parent 6f63fe7d7c
commit 5d6b54d2fc
16 changed files with 767 additions and 4 deletions
+10
View File
@@ -0,0 +1,10 @@
namespace DeepDrftModels.DTOs;
// Mirror of MixMetadata (Phase 9). No `required` members — BlazorBlocks's Manager<> generic
// constraint requires `new()`, which does not compose with required members. TrackConverter assigns
// every field on the round-trip, so an empty default is never observable.
public class MixMetadataDto
{
public long ReleaseId { get; set; }
public string WaveformEntryKey { get; set; } = string.Empty;
}
+10 -1
View File
@@ -14,7 +14,16 @@ public class ReleaseDto : BaseModel
public string? Genre { get; set; }
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
public ReleaseMedium Medium { get; set; } = ReleaseMedium.Cut;
// Nullable: meaningful only for Cut releases. TrackConverter nulls it for Session/Mix at the
// mapping point. One producer enforces the rule; no consumer depends on a non-null value.
public ReleaseType? ReleaseType { get; set; }
// Medium-specific satellites. Populated only for the matching medium; null otherwise.
public SessionMetadataDto? SessionMetadata { get; set; }
public MixMetadataDto? MixMetadata { get; set; }
public long? CreatedByUserId { get; set; }
// Read-model field: count of non-deleted tracks in this release. Not on ReleaseEntity — the
+10
View File
@@ -0,0 +1,10 @@
namespace DeepDrftModels.DTOs;
// Mirror of SessionMetadata (Phase 9). No `required` members — BlazorBlocks's Manager<> generic
// constraint requires `new()`, which does not compose with required members. TrackConverter assigns
// every field on the round-trip, so an empty default is never observable.
public class SessionMetadataDto
{
public long ReleaseId { get; set; }
public string HeroImageEntryKey { get; set; } = string.Empty;
}
+17
View File
@@ -0,0 +1,17 @@
using Models.Entities;
namespace DeepDrftModels.Entities;
// 1:1 satellite for Mix-medium releases (Phase 9). One row per Mix ReleaseEntity, keyed by a unique
// ReleaseId FK (the 1:1 enforcement lives in MixMetadataConfiguration). Carries the entry key for
// the preprocessed high-resolution waveform datum.
//
// Inherits Id, CreatedAt, UpdatedAt, IsDeleted from BaseEntity (Cerebellum.BlazorBlocks.Models).
// BaseEntity ships the audit columns but does not declare IEntity itself, so subclasses declare it
// explicitly to satisfy the generic constraints on Repository<>/Manager<>/etc.
public class MixMetadata : BaseEntity, IEntity
{
public long ReleaseId { get; set; }
public ReleaseEntity Release { get; set; } = null!;
public required string WaveformEntryKey { get; set; }
}
+7
View File
@@ -18,6 +18,13 @@ public class ReleaseEntity : BaseEntity, IEntity
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
public ReleaseMedium Medium { get; set; } = ReleaseMedium.Cut;
public long? CreatedByUserId { get; set; }
public ICollection<TrackEntity> Tracks { get; set; } = new List<TrackEntity>();
// 1:1 satellites selected by Medium. Null unless this release is the matching medium —
// Session releases carry SessionMetadata, Mix releases carry MixMetadata, Cut releases carry
// neither (ReleaseType on this table is their discriminator data).
public SessionMetadata? SessionMetadata { get; set; }
public MixMetadata? MixMetadata { get; set; }
}
@@ -0,0 +1,17 @@
using Models.Entities;
namespace DeepDrftModels.Entities;
// 1:1 satellite for Session-medium releases (Phase 9). One row per Session ReleaseEntity, keyed by
// a unique ReleaseId FK (the 1:1 enforcement lives in SessionMetadataConfiguration). Carries the
// hero-image entry key into the Image vault.
//
// Inherits Id, CreatedAt, UpdatedAt, IsDeleted from BaseEntity (Cerebellum.BlazorBlocks.Models).
// BaseEntity ships the audit columns but does not declare IEntity itself, so subclasses declare it
// explicitly to satisfy the generic constraints on Repository<>/Manager<>/etc.
public class SessionMetadata : BaseEntity, IEntity
{
public long ReleaseId { get; set; }
public ReleaseEntity Release { get; set; } = null!;
public required string HeroImageEntryKey { get; set; }
}
+16
View File
@@ -0,0 +1,16 @@
namespace DeepDrftModels.Enums;
/// <summary>
/// The medium of a release — the Phase 9 discriminator that selects which metadata shape applies.
/// </summary>
public enum ReleaseMedium
{
/// <summary>Studio recording. Uses <see cref="ReleaseType"/> (Single/EP/Album). The default.</summary>
Cut,
/// <summary>Single live track plus a hero image. Detail in <c>SessionMetadata</c>.</summary>
Session,
/// <summary>Single long track plus a preprocessed high-resolution waveform datum. Detail in <c>MixMetadata</c>.</summary>
Mix
}