Removes the last YouTube-specific routes (/youtube/*) and merges them
into the general track/album/playlist endpoints, keyed by a `source`
string validated against TrackSource. This mirrors the earlier track
search merge for albums and playlist-track additions:
- GetAlbums now merges local albums with live YouTube Music search
results, paginated via a youtubeContinuationToken, deduped against
already-materialized ExternalAlbum rows.
- New GET /albums/external/{source}/{externalId} and
GET /tracks/external/{source}/{externalId}/stream replace the
YouTube-only equivalents.
- POST /playlists/{id}/tracks replaces the separate
.../youtube-tracks endpoint, accepting an optional Source/ExternalId
pair alongside TrackId.
- AlbumSearchItemResponse/AlbumsSearchResponse follow the same
discriminated-union + trailing-HasNextPage-field pattern already
used for track search, so HasNextPage stays a required field in the
generated OpenAPI schema.
- Frontend routes renamed accordingly (/albums/youtube/[albumId] ->
/albums/external/[source]/[externalId], etc.) with a single
/api/thumbnail proxy replacing /api/youtube/thumbnail.
Musify.Api.Endpoints.YouTubeEndpoints and the standalone
SearchYouTubeAlbums query are removed as a result.
23 lines
1.0 KiB
C#
23 lines
1.0 KiB
C#
using Musify.Application.Contracts;
|
|
using Musify.Domain.ValueObjects;
|
|
|
|
namespace Musify.Application.Albums.Responses
|
|
{
|
|
/// <summary>One item of a combined local/external album listing. Exactly one of
|
|
/// <see cref="Album"/> or <see cref="YouTubeAlbum"/> is populated: <see cref="Album"/> for
|
|
/// anything already in the catalog (locally created albums and external albums materialized
|
|
/// earlier), <see cref="YouTubeAlbum"/> for a live external search hit that hasn't been
|
|
/// materialized yet, so it has no album id.</summary>
|
|
public record AlbumSearchItemResponse(
|
|
TrackSource Source,
|
|
AlbumApplicationResponse? Album,
|
|
YouTubeAlbumResult? YouTubeAlbum)
|
|
{
|
|
public static AlbumSearchItemResponse FromAlbum(AlbumApplicationResponse album) =>
|
|
new(album.YouTubeAlbumId is not null ? TrackSource.YouTube : TrackSource.Local, album, null);
|
|
|
|
public static AlbumSearchItemResponse FromYouTubeAlbum(YouTubeAlbumResult album) =>
|
|
new(TrackSource.YouTube, null, album);
|
|
}
|
|
}
|