Flip ITrackService/TrackManager to DTO output; TrackConverter is the sole entity<->DTO path across all consumers

This commit is contained in:
Daniel Harvey
2026-05-25 11:35:04 -04:00
parent 81fc87391b
commit 4351302a25
23 changed files with 156 additions and 156 deletions
+2 -2
View File
@@ -164,8 +164,8 @@ public class CliService
return;
}
// Add track to SQL database
var result = await _webTrackService.Create(trackEntity);
// Add track to SQL database (service layer is DTO-typed)
var result = await _webTrackService.Create(DeepDrftData.TrackConverter.Convert(trackEntity));
if (result.Success && result.Value != null)
{
Console.WriteLine($"✓ Track added successfully!");
+8 -7
View File
@@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging;
using Terminal.Gui;
using DeepDrftModels.Entities;
using DeepDrftData;
using DeepDrftModels.DTOs;
using DeepDrftCli.Utils;
namespace DeepDrftCli.Services;
@@ -20,7 +21,7 @@ public class GuiService
private ListView? _trackListView;
private TextView? _statusView;
private FrameView? _legendFrame;
private List<TrackEntity> _tracks = new();
private List<TrackDto> _tracks = new();
public GuiService(
ILogger<GuiService> logger,
@@ -541,7 +542,7 @@ public class GuiService
/// <summary>
/// Delete the specified track from the database
/// </summary>
private async Task DeleteTrackAsync(TrackEntity trackToDelete)
private async Task DeleteTrackAsync(TrackDto trackToDelete)
{
try
{
@@ -650,8 +651,8 @@ public class GuiService
return false;
}
// Add to SQL database
var result = await _webTrackService.Create(trackEntity);
// Add to SQL database (service layer is DTO-typed)
var result = await _webTrackService.Create(TrackConverter.Convert(trackEntity));
if (result.Success && result.Value != null)
{
UpdateStatus($"✓ Track '{trackName}' by {artist} added successfully!");
@@ -676,7 +677,7 @@ public class GuiService
/// <summary>
/// Validate input and update existing track in database
/// </summary>
private async Task<bool> ValidateAndUpdateTrackAsync(TrackEntity originalTrack, string trackName,
private async Task<bool> ValidateAndUpdateTrackAsync(TrackDto originalTrack, string trackName,
string artist, string album, string genre, string releaseDate)
{
try
@@ -709,7 +710,7 @@ public class GuiService
UpdateStatus("Updating track...");
// Create updated track entity
var updatedTrack = new TrackEntity
var updatedTrack = new TrackDto
{
Id = originalTrack.Id,
EntryKey = originalTrack.EntryKey, // Keep original entry key