Summary endpoint for the operations dashboard

C# · ASP.NET Core · advanced · greenfield

Adds the summary endpoint the new operations dashboard polls. `DashboardController` (new) serves `GET /api/dashboard/summary`: it starts the order stats call and the helpdesk call together, waits for both, and combines their results into the new `DashboardSummary` record (`DashboardSummary.cs`). It passes the request's abort token to both calls, and an upstream failure surfaces through the existing exception handler as a 500. `DashboardSummaryTests.cs` adds xUnit tests on `WebApplicationFactory<Program>` with in-memory fakes for the two clients: the combined body, an upstream failure and the sign-in requirement.

ASP.NET Core 10 Web API on .NET 10 (C# 14, nullable reference types enabled, implicit usings), controllers with `[ApiController]`. Production runs the API as a single instance: one Linux container with 2 vCPUs (`Environment.ProcessorCount` is 2), with the runtime's default thread pool settings (no `SetMinThreads` anywhere). Existing and unchanged, all registered in `Program.cs`: `IOrderStatsClient` and `IHelpdeskClient` are typed `HttpClient`s (`AddHttpClient`, 5-second timeout), async throughout. `GetTodayTotalsAsync(ct)` returns `OrderTotals(int OrderCount, long RevenueCents)` from the internal analytics service, which aggregates on the fly and answers in 300 to 800 ms, about 500 ms typically. `GetOpenTicketCountsAsync(ct)` returns `TicketCounts(int Open, int Urgent)` from the helpdesk in 100 to 400 ms. Both throw `HttpRequestException` on a network error or a non-2xx answer. `UseExceptionHandler()` with `AddProblemDetails()` turns any unhandled exception into a generic 500 problem response and logs it. Staff sign in with JWT bearer tokens. The existing test project `tests/Shop.Api.Tests` (xUnit, references `Microsoft.AspNetCore.Mvc.Testing`) signs staff in through a test authentication scheme that `Program.cs` registers outside Production: a request with an `X-Test-Staff: <id>` header is a signed-in staff member, and every existing integration test uses it. `MapHealthChecks("/health")` serves the load balancer's probe. Every existing controller action that does I/O is `async Task<...>` and takes a `CancellationToken`. JSON uses the ASP.NET Core web defaults (camelCase). The dashboard page ships separately and only reads this endpoint.

Requirements

Files touched

Review this PR

C# practice