Wire NowPlayingStats to live aggregates: add SQL track duration column, stats endpoint, and duration backfill

This commit is contained in:
daniel-c-harvey
2026-06-18 11:53:49 -04:00
parent 8ddecb4acc
commit 5f0422a263
26 changed files with 1089 additions and 9 deletions
@@ -0,0 +1,15 @@
using DeepDrftModels.DTOs;
using NetBlocks.Models;
namespace DeepDrftPublic.Client.Services;
/// <summary>
/// Home-stats read abstraction. Both SSR and WASM renders are served by <c>StatsClientDataService</c>
/// in this assembly, which delegates to <see cref="Clients.StatsClient"/> over HTTP. Components inject
/// this single seam so they do not branch on render mode — mirrors <see cref="IReleaseDataService"/>.
/// </summary>
public interface IStatsDataService
{
/// <summary>Aggregate figures behind the public home hero stat row, in one round-trip.</summary>
Task<ApiResult<HomeStatsDto>> GetHomeStats();
}
@@ -0,0 +1,22 @@
using DeepDrftModels.DTOs;
using DeepDrftPublic.Client.Clients;
using NetBlocks.Models;
namespace DeepDrftPublic.Client.Services;
/// <summary>
/// <see cref="IStatsDataService"/> backed by <see cref="StatsClient"/> (HTTP to the <c>DeepDrft.API</c>
/// backend). Used on both the SSR prerender and WASM interactive passes — the stats read surface is
/// HTTP-only, so there is no separate in-process implementation.
/// </summary>
public class StatsClientDataService : IStatsDataService
{
private readonly StatsClient _statsClient;
public StatsClientDataService(StatsClient statsClient)
{
_statsClient = statsClient;
}
public Task<ApiResult<HomeStatsDto>> GetHomeStats() => _statsClient.GetHomeStats();
}