- POST /api/playlists/{id:int}/items wraps the existing AddItemsToPlaylist
command (mirrors CollectionController.AddItems); controller pre-checks
playlist existence for a real 404, and the handler now rejects adds to
system (generated) playlists, matching the guard already applied to
rename/delete/replace-items so the Blazor path gets the same protection.
- GET /api/search/all-items wraps the existing QuerySearchIndexAllItems
query, returning a new SearchResultAllItemsResponseModel (never expose
the VM directly) so the SPA's shared "add all to collection/playlist"
component can materialize ids before calling the add endpoints, same
two-step flow Blazor's Search.razor already uses.
- Show-detail DTO check: ShowDetailResponseModel already exposes
libraryId, title, and mediaSourceKind (serialized as a string enum via
the global StringEnumConverter) - no changes needed.
Adds controller tests (route table + per-action) for both endpoints and
regenerates the OpenAPI document, endpoint index, and SPA client types.
31 lines
792 B
C#
31 lines
792 B
C#
using ErsatzTV.Application.MediaCollections;
|
|
|
|
namespace ErsatzTV.Controllers.Api.Requests;
|
|
|
|
public record AddItemsToPlaylistRequest(
|
|
List<int> MovieIds,
|
|
List<int> ShowIds,
|
|
List<int> SeasonIds,
|
|
List<int> EpisodeIds,
|
|
List<int> ArtistIds,
|
|
List<int> MusicVideoIds,
|
|
List<int> OtherVideoIds,
|
|
List<int> SongIds,
|
|
List<int> ImageIds,
|
|
List<int> RemoteStreamIds)
|
|
{
|
|
public AddItemsToPlaylist ToCommand(int playlistId) =>
|
|
new(
|
|
playlistId,
|
|
MovieIds ?? [],
|
|
ShowIds ?? [],
|
|
SeasonIds ?? [],
|
|
EpisodeIds ?? [],
|
|
ArtistIds ?? [],
|
|
MusicVideoIds ?? [],
|
|
OtherVideoIds ?? [],
|
|
SongIds ?? [],
|
|
ImageIds ?? [],
|
|
RemoteStreamIds ?? []);
|
|
}
|