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:
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user