Add bulk poster filling endpoint and enhance show deletion options
Introduced a new endpoint for bulk filling collection posters, allowing for automatic assignment of posters to collections without existing images. Updated the DeleteShowCommand to include an option for cutting shows from future airings, enhancing the deletion process. Refactored related components and API calls to support these features, ensuring a seamless user experience. Additionally, updated localization strings to reflect the new functionalities and adjusted tests to verify correct behavior.
This commit is contained in:
@@ -5,6 +5,7 @@ using TeleWave.Application.Library.Collections.AddCollectionShow;
|
||||
using TeleWave.Application.Library.Collections.AddShowsToCollection;
|
||||
using TeleWave.Application.Library.Collections.CreateCollection;
|
||||
using TeleWave.Application.Library.Collections.DeleteCollection;
|
||||
using TeleWave.Application.Library.Collections.FillCollectionPosters;
|
||||
using TeleWave.Application.Library.Collections.GetCollection;
|
||||
using TeleWave.Application.Library.Collections.ListCollections;
|
||||
using TeleWave.Application.Library.Collections.RemoveCollectionShow;
|
||||
@@ -40,6 +41,8 @@ public static class CollectionEndpoints
|
||||
|
||||
// Сборка франшиз: массовое добавление отмеченных шоу и предложения по библиотеке.
|
||||
admin.MapPost("/bulk/shows", AddShows).Produces<AddShowsToCollectionResultDto>();
|
||||
// Постеры по частям: без списка — всем коллекциям, у которых постера ещё нет.
|
||||
admin.MapPost("/bulk/posters", FillPosters).Produces<int>();
|
||||
admin
|
||||
.MapGet("/suggestions", Suggestions)
|
||||
.Produces<IReadOnlyList<CollectionSuggestionDto>>();
|
||||
@@ -50,6 +53,19 @@ public static class CollectionEndpoints
|
||||
return app;
|
||||
}
|
||||
|
||||
private static async Task<IResult> FillPosters(
|
||||
FillCollectionPostersBody? body,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(
|
||||
new FillCollectionPostersCommand(body?.CollectionIds),
|
||||
cancellationToken
|
||||
);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> AddShows(
|
||||
AddShowsToCollectionBody body,
|
||||
ISender sender,
|
||||
@@ -225,3 +241,5 @@ public sealed record AddShowsToCollectionBody(
|
||||
);
|
||||
|
||||
public sealed record CreateCollectionFromSuggestionBody(string Key);
|
||||
|
||||
public sealed record FillCollectionPostersBody(IReadOnlyList<Guid>? CollectionIds);
|
||||
|
||||
Reference in New Issue
Block a user