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
+23 -2
View File
@@ -1,5 +1,6 @@
using DeepDrftModels.DTOs;
using DeepDrftModels.Entities;
using DeepDrftModels.Enums;
using Models.Converters;
namespace DeepDrftData;
@@ -25,7 +26,24 @@ public class TrackConverter : IEntityToModelConverter<TrackEntity, TrackDto>
Genre = entity.Genre,
ReleaseDate = entity.ReleaseDate,
ImagePath = entity.ImagePath,
ReleaseType = entity.ReleaseType,
Medium = entity.Medium,
// ReleaseType is meaningful only for Cut; null it for Session/Mix at the mapping point so no
// consumer mistakes a stale studio-format value for a live/mix release.
ReleaseType = entity.Medium == ReleaseMedium.Cut ? entity.ReleaseType : (ReleaseType?)null,
SessionMetadata = entity.SessionMetadata is null
? null
: new SessionMetadataDto
{
ReleaseId = entity.SessionMetadata.ReleaseId,
HeroImageEntryKey = entity.SessionMetadata.HeroImageEntryKey
},
MixMetadata = entity.MixMetadata is null
? null
: new MixMetadataDto
{
ReleaseId = entity.MixMetadata.ReleaseId,
WaveformEntryKey = entity.MixMetadata.WaveformEntryKey
},
CreatedByUserId = entity.CreatedByUserId
};
@@ -39,7 +57,10 @@ public class TrackConverter : IEntityToModelConverter<TrackEntity, TrackDto>
Genre = dto.Genre,
ReleaseDate = dto.ReleaseDate,
ImagePath = dto.ImagePath,
ReleaseType = dto.ReleaseType,
Medium = dto.Medium,
// Entity ReleaseType is non-nullable; default back to Single when the DTO nulled it for a
// non-Cut release. Primarily a write-path reconstruction concern.
ReleaseType = dto.ReleaseType ?? ReleaseType.Single,
CreatedByUserId = dto.CreatedByUserId
};