Implement functionality to add shows to existing collections from suggestions
Added a new endpoint for adding shows to already assembled franchises based on the same suggestion key. Updated the CollectionSuggestion and CollectionSuggestionDto records to include a CollectionId for tracking existing collections. Enhanced the CollectionSuggestions component in the frontend to support this new functionality, allowing users to add missing parts to existing collections. Updated localization strings to reflect the new addition feature in both English and Russian, ensuring clarity for users. Adjusted tests to verify the correct behavior of the addition process and its integration with existing collection logic.
This commit is contained in:
@@ -49,6 +49,8 @@ public static class CollectionEndpoints
|
||||
admin
|
||||
.MapPost("/suggestions", CreateFromSuggestion)
|
||||
.Produces<CreatedIdResponse>(StatusCodes.Status201Created);
|
||||
// Дополнение уже собранной франшизы: коллекция определяется тем же ключом предложения.
|
||||
admin.MapPost("/suggestions/add", AddFromSuggestion).Produces<int>();
|
||||
|
||||
return app;
|
||||
}
|
||||
@@ -110,6 +112,16 @@ public static class CollectionEndpoints
|
||||
: result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> AddFromSuggestion(
|
||||
CreateCollectionFromSuggestionBody body,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(new AddSuggestedShowsCommand(body.Key), cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> ListCollections(
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
|
||||
Reference in New Issue
Block a user