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.
39 lines
1.9 KiB
C#
39 lines
1.9 KiB
C#
namespace Musify.Application.Albums.Responses
|
|
{
|
|
/// <summary>Result of a combined albums listing/search: a page of local catalog albums
|
|
/// (user-created and previously materialized external albums), plus, when a search term was
|
|
/// given, live external hits appended after them. Pagination metadata (<see cref="PageNumber"/>,
|
|
/// <see cref="PageSize"/>, <see cref="PageCount"/>, <see cref="TotalItemCount"/>) describes only
|
|
/// the local page — the external source has no stable total, so its continuation is tracked
|
|
/// separately via <see cref="NextYoutubeContinuationToken"/>.</summary>
|
|
public record AlbumsSearchResponse(
|
|
IReadOnlyList<AlbumSearchItemResponse> Items,
|
|
int PageNumber,
|
|
int PageSize,
|
|
int PageCount,
|
|
int TotalItemCount,
|
|
bool HasPreviousPage,
|
|
bool HasNextLocalPage,
|
|
string? NextYoutubeContinuationToken,
|
|
bool YoutubeUnavailable,
|
|
bool HasNextPage)
|
|
{
|
|
// HasNextPage is a real field (not a computed property) so it shows up as a required member
|
|
// of the generated OpenAPI schema, same as every other field here — a get-only property added
|
|
// outside the primary constructor gets reflected as optional instead, which is never true here.
|
|
public static AlbumsSearchResponse Create(
|
|
IReadOnlyList<AlbumSearchItemResponse> items,
|
|
int pageNumber,
|
|
int pageSize,
|
|
int pageCount,
|
|
int totalItemCount,
|
|
bool hasPreviousPage,
|
|
bool hasNextLocalPage,
|
|
string? nextYoutubeContinuationToken,
|
|
bool youtubeUnavailable) =>
|
|
new(items, pageNumber, pageSize, pageCount, totalItemCount, hasPreviousPage, hasNextLocalPage,
|
|
nextYoutubeContinuationToken, youtubeUnavailable,
|
|
HasNextPage: hasNextLocalPage || !string.IsNullOrEmpty(nextYoutubeContinuationToken));
|
|
}
|
|
}
|