feat(routing): add ReleaseRoutes.DetailHref resolver; repoint release click sites and add /tracks/{id} redirect (P11 W2 §2)

This commit is contained in:
daniel-c-harvey
2026-06-16 10:56:28 -04:00
parent 74b9c02722
commit 55515981a9
8 changed files with 128 additions and 18 deletions
@@ -0,0 +1,30 @@
using DeepDrftModels.DTOs;
using DeepDrftModels.Enums;
namespace DeepDrftPublic.Client.Common;
/// <summary>
/// The single source of truth for a release's dedicated detail route (Phase 11 §2). A release
/// resolves to its per-medium detail page purely from its id and <see cref="ReleaseMedium"/> — no
/// round-trip needed at call sites that already hold the medium (Archive cards, AlbumsView cards,
/// the player-bar title). The thin <c>/tracks/{id}</c> redirect page fetches by id to discover the
/// medium, then resolves through this same helper, so the medium→route table lives in exactly one
/// place.
/// </summary>
public static class ReleaseRoutes
{
/// <summary>
/// The dedicated detail route for a release: <c>/cuts/{id}</c>, <c>/sessions/{id}</c>, or
/// <c>/mixes/{id}</c>. Cut is the default arm so a new medium without an entry here surfaces a
/// build-visible gap rather than a silent fallthrough — extend the switch when a fourth medium lands.
/// </summary>
public static string DetailHref(long id, ReleaseMedium medium) => medium switch
{
ReleaseMedium.Session => $"/sessions/{id}",
ReleaseMedium.Mix => $"/mixes/{id}",
_ => $"/cuts/{id}",
};
/// <summary>Convenience overload for call sites holding a <see cref="ReleaseDto"/>.</summary>
public static string DetailHref(ReleaseDto release) => DetailHref(release.Id, release.Medium);
}