refactor(backend): group track pipeline state into owned types
Track mixed catalog fields (Title, Artist credit, Duration) with picture-processing and audio-transcode pipeline state as ten flat columns plus two computed [NotMapped] flags, making the entity read like a media-pipeline worksheet. Introduce TrackPictures and TrackAudio as EF owned types mapped onto the same existing columns (explicit column names, no schema change - verified via `dotnet ef migrations has-pending-model-changes`). Track now reads as Title/Artist/Duration/Pictures/Audio instead of fourteen loose properties.
This commit is contained in:
+14
-14
@@ -40,16 +40,16 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
|
||||
|
||||
var log = new UpdateTrackPictureLog(
|
||||
track.Id,
|
||||
track.OriginalPictureName,
|
||||
track.SmallPictureName,
|
||||
track.MediumPictureName,
|
||||
track.LargePictureName);
|
||||
track.Pictures.OriginalName,
|
||||
track.Pictures.SmallName,
|
||||
track.Pictures.MediumName,
|
||||
track.Pictures.LargeName);
|
||||
|
||||
track.OriginalPictureName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
|
||||
track.SmallPictureName = Path.GetFileName(smallResizedVariable);
|
||||
track.MediumPictureName = Path.GetFileName(mediumResizedVariable);
|
||||
track.LargePictureName = Path.GetFileName(largeResizedVariable);
|
||||
track.PicturesProcessingStatus = ProcessingStatus.Completed;
|
||||
track.Pictures.OriginalName = Path.GetFileName(executeContext.Arguments.OriginalPictureKey);
|
||||
track.Pictures.SmallName = Path.GetFileName(smallResizedVariable);
|
||||
track.Pictures.MediumName = Path.GetFileName(mediumResizedVariable);
|
||||
track.Pictures.LargeName = Path.GetFileName(largeResizedVariable);
|
||||
track.Pictures.ProcessingStatus = ProcessingStatus.Completed;
|
||||
|
||||
database.Tracks.Update(track);
|
||||
await database.SaveChangesAsync(executeContext.CancellationToken);
|
||||
@@ -82,11 +82,11 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
|
||||
if (track is null)
|
||||
return compensateContext.Compensated();
|
||||
|
||||
track.OriginalPictureName = compensateContext.Log.PreviousOriginalPictureKey;
|
||||
track.SmallPictureName = compensateContext.Log.PreviousSmallPictureKey;
|
||||
track.MediumPictureName = compensateContext.Log.PreviousMediumPictureKey;
|
||||
track.LargePictureName = compensateContext.Log.PreviousLargePictureKey;
|
||||
track.PicturesProcessingStatus = ProcessingStatus.Failed;
|
||||
track.Pictures.OriginalName = compensateContext.Log.PreviousOriginalPictureKey;
|
||||
track.Pictures.SmallName = compensateContext.Log.PreviousSmallPictureKey;
|
||||
track.Pictures.MediumName = compensateContext.Log.PreviousMediumPictureKey;
|
||||
track.Pictures.LargeName = compensateContext.Log.PreviousLargePictureKey;
|
||||
track.Pictures.ProcessingStatus = ProcessingStatus.Failed;
|
||||
|
||||
database.Tracks.Update(track);
|
||||
await database.SaveChangesAsync(compensateContext.CancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user