fix(manager): review remediation — DeleteTrackAsync dead code, TrackEdit Id long, dead @using
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
@page "/cms/tracks/{Id:int}"
|
@page "/cms/tracks/{Id:long}"
|
||||||
@using DeepDrftManager.Services
|
@using DeepDrftManager.Services
|
||||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||||
@inject ITrackService TrackService
|
@inject ITrackService TrackService
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</MudContainer>
|
</MudContainer>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public int Id { get; set; }
|
[Parameter] public long Id { get; set; }
|
||||||
|
|
||||||
private TrackEntity? _track;
|
private TrackEntity? _track;
|
||||||
private TrackEditForm _form = new();
|
private TrackEditForm _form = new();
|
||||||
|
|||||||
@@ -16,4 +16,3 @@
|
|||||||
@using Models.Common
|
@using Models.Common
|
||||||
@using AuthBlocksModels.SystemDefinitions
|
@using AuthBlocksModels.SystemDefinitions
|
||||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||||
@using AuthBlocksWeb.Services
|
|
||||||
|
|||||||
@@ -142,17 +142,18 @@ public class CmsTrackService : ICmsTrackService
|
|||||||
var lookup = await _trackService.GetById(id);
|
var lookup = await _trackService.GetById(id);
|
||||||
if (!lookup.Success)
|
if (!lookup.Success)
|
||||||
{
|
{
|
||||||
var error = lookup.Messages.FirstOrDefault()?.Message;
|
var error = lookup.Messages.FirstOrDefault()?.Message ?? "unknown error";
|
||||||
_logger.LogError("CMS delete: lookup failed for track {TrackId}: {Error}", id, error);
|
_logger.LogError("CMS delete: GetById threw for track {TrackId}: {Error}", id, error);
|
||||||
return Result.CreateFailResult("Failed to load track.");
|
return Result.CreateFailResult("Failed to load track.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var track = lookup.Value;
|
if (lookup.Value is null)
|
||||||
if (track is null)
|
|
||||||
{
|
{
|
||||||
return Result.CreateFailResult("Track not found.");
|
return Result.CreateFailResult("Track not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var track = lookup.Value;
|
||||||
|
|
||||||
var entryKey = track.EntryKey;
|
var entryKey = track.EntryKey;
|
||||||
|
|
||||||
// 2. SQL delete. On failure, do NOT touch the vault — nothing to clean up.
|
// 2. SQL delete. On failure, do NOT touch the vault — nothing to clean up.
|
||||||
|
|||||||
Reference in New Issue
Block a user