feat: normalize release-cardinal fields out of track into a Release entity (Phase 8 §8.0)

This commit is contained in:
daniel-c-harvey
2026-06-11 12:51:21 -04:00
parent 16f356a760
commit f767d288c5
33 changed files with 1032 additions and 297 deletions
+1
View File
@@ -4,6 +4,7 @@ namespace DeepDrftModels.DTOs;
/// One distinct album with its track count and a representative cover image key. Backs the
/// /albums browse grid.
/// </summary>
[Obsolete("Replaced by ReleaseDto. Use ITrackService.GetReleases().")]
public class AlbumSummaryDto
{
public required string Album { get; set; }
+24
View File
@@ -0,0 +1,24 @@
using DeepDrftModels.Enums;
using Models.Models;
namespace DeepDrftModels.DTOs;
// Mirror of ReleaseEntity (Phase 8 §8.0). Inherits Id, CreatedAt, UpdatedAt from BaseModel
// (Cerebellum.BlazorBlocks.Models). No `required` members — BlazorBlocks's Manager<> generic
// constraint requires `new()`, which does not compose with required members (see TrackDto header).
// TrackConverter assigns every field on the round-trip, so an empty default is never observable.
public class ReleaseDto : BaseModel
{
public string Title { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
public string? Genre { get; set; }
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
public long? CreatedByUserId { get; set; }
// Read-model field: count of non-deleted tracks in this release. Not on ReleaseEntity — the
// service projects it from the joined Tracks collection so the /albums browse grid and the CMS
// dashboard can show a per-album track count. Defaults to 0 when not populated.
public int TrackCount { get; set; }
}
+7 -11
View File
@@ -1,4 +1,3 @@
using DeepDrftModels.Enums;
using Models.Models;
namespace DeepDrftModels.DTOs;
@@ -6,20 +5,17 @@ namespace DeepDrftModels.DTOs;
// Inherits Id, CreatedAt, UpdatedAt from BaseModel (Cerebellum.BlazorBlocks.Models).
// BlazorBlocks's Manager<> generic constraint requires `new()` on the model type, which
// disqualifies `required` properties (the `new()` constraint and required members do not
// compose). EntryKey/TrackName/Artist therefore drop `required` here — the TrackEntity
// side remains required, and TrackConverter assigns every field on the round-trip so an
// empty default is never observable in production code paths.
// compose). EntryKey/TrackName therefore drop `required` here — the TrackEntity side remains
// required, and TrackConverter assigns every field on the round-trip so an empty default is
// never observable in production code paths.
//
// Track-cardinal data only (Phase 8 §8.0). Release-cardinal fields are read via Release?.X.
public class TrackDto : BaseModel
{
public string EntryKey { get; set; } = string.Empty;
public string TrackName { get; set; } = string.Empty;
public string Artist { get; set; } = string.Empty;
public string? Album { get; set; }
public string? Genre { get; set; }
public DateOnly? ReleaseDate { get; set; }
public string? ImagePath { get; set; }
public long? CreatedByUserId { get; set; }
public string? OriginalFileName { get; set; }
public ReleaseType ReleaseType { get; set; } = ReleaseType.Single;
public int TrackNumber { get; set; } = 1;
public long? ReleaseId { get; set; }
public ReleaseDto? Release { get; set; }
}