Add CMS track delete: DeepDrftContent DELETE endpoint, DeepDrftWeb SQL-first orchestration, DeepDrftCms confirmation dialog (W3-T3)

This commit is contained in:
Daniel Harvey
2026-05-18 15:20:08 -04:00
parent f46c2557c8
commit 4a59df6baa
11 changed files with 325 additions and 4 deletions
+21 -1
View File
@@ -7,6 +7,13 @@ namespace DeepDrftWeb;
public static class Startup
{
/// <summary>
/// Named HttpClient used by CMS controllers to call DeepDrftContent's ApiKey-protected endpoints.
/// Distinct from the public WASM-facing "DeepDrft.Content" client so the API key never reaches
/// the browser. Configured server-side only.
/// </summary>
public const string ContentCmsHttpClientName = "DeepDrft.Content.Cms";
public static void ConfigureDomainServices(WebApplicationBuilder builder)
{
// Add Entity Framework services
@@ -18,11 +25,24 @@ public static class Startup
builder.Services
.AddHttpContextAccessor()
.AddScoped<DarkModeService>();
// Add Track services
builder.Services
.AddScoped<TrackRepository>()
.AddScoped<ITrackService, TrackService>();
// CMS → DeepDrftContent client. The API key is required up front (no lazy resolution)
// so a misconfiguration surfaces at startup instead of on the first delete attempt.
var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"]
?? throw new InvalidOperationException("ApiUrls:ContentApi is required");
var contentApiKey = builder.Configuration["DeepDrftContent:ApiKey"]
?? throw new InvalidOperationException("DeepDrftContent:ApiKey is required (see environment/apikey.json)");
builder.Services.AddHttpClient(ContentCmsHttpClientName, client =>
{
client.BaseAddress = new Uri(contentApiUrl);
client.DefaultRequestHeaders.Add("ApiKey", contentApiKey);
});
}
public static string GetKestrelUrl(this WebApplicationBuilder builder)