fix(manager): review remediation — DeleteTrackAsync dead code, TrackEdit Id long, dead @using

This commit is contained in:
Daniel Harvey
2026-05-24 21:14:26 -04:00
parent 428359b241
commit 7f99479cae
3 changed files with 7 additions and 7 deletions
@@ -1,4 +1,4 @@
@page "/cms/tracks/{Id:int}"
@page "/cms/tracks/{Id:long}"
@using DeepDrftManager.Services
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
@inject ITrackService TrackService
@@ -89,7 +89,7 @@
</MudContainer>
@code {
[Parameter] public int Id { get; set; }
[Parameter] public long Id { get; set; }
private TrackEntity? _track;
private TrackEditForm _form = new();
@@ -16,4 +16,3 @@
@using Models.Common
@using AuthBlocksModels.SystemDefinitions
@using AuthBlocksWeb.HierarchicalAuthorize
@using AuthBlocksWeb.Services
+5 -4
View File
@@ -142,17 +142,18 @@ public class CmsTrackService : ICmsTrackService
var lookup = await _trackService.GetById(id);
if (!lookup.Success)
{
var error = lookup.Messages.FirstOrDefault()?.Message;
_logger.LogError("CMS delete: lookup failed for track {TrackId}: {Error}", id, error);
var error = lookup.Messages.FirstOrDefault()?.Message ?? "unknown error";
_logger.LogError("CMS delete: GetById threw for track {TrackId}: {Error}", id, error);
return Result.CreateFailResult("Failed to load track.");
}
var track = lookup.Value;
if (track is null)
if (lookup.Value is null)
{
return Result.CreateFailResult("Track not found.");
}
var track = lookup.Value;
var entryKey = track.EntryKey;
// 2. SQL delete. On failure, do NOT touch the vault — nothing to clean up.