Implement collection suggestions and bulk show addition features
ci / build-backend (push) Successful in 2m41s
ci / build-frontend (push) Successful in 44s
ci / tests (push) Successful in 2m33s
ci / sonar (push) Successful in 5m12s

Added new API endpoints for suggesting collections based on existing shows and for bulk adding shows to collections. Enhanced the backend with necessary logic and DTOs to support these features. Updated the frontend to include new components for displaying collection suggestions and managing bulk additions, improving the user experience for collection management. Localization updates were made to support these new features in both English and Russian.
This commit is contained in:
Leonid Pershin
2026-07-27 05:39:23 +03:00
parent 1a7f73a5bd
commit 5ad28b2966
39 changed files with 2710 additions and 10 deletions
@@ -0,0 +1,40 @@
using LiteCqrs;
using Microsoft.EntityFrameworkCore;
using TeleWave.Application.Common.Interfaces;
namespace TeleWave.Application.Library.Collections.Suggest;
public sealed class SuggestCollectionsQueryHandler(
IAppDbContext dbContext,
CollectionSuggestionBuilder builder
) : IQueryHandler<SuggestCollectionsQuery, IReadOnlyList<CollectionSuggestionDto>>
{
public async Task<IReadOnlyList<CollectionSuggestionDto>> Handle(
SuggestCollectionsQuery query,
CancellationToken cancellationToken
)
{
var suggestions = await builder.BuildAsync(cancellationToken);
if (suggestions.Count == 0)
return [];
var names = await dbContext
.Collections.AsNoTracking()
.Select(c => c.Name)
.ToListAsync(cancellationToken);
var existing = names
.Select(n => n.Trim())
.ToHashSet(StringComparer.CurrentCultureIgnoreCase);
return
[
.. suggestions.Select(s => new CollectionSuggestionDto(
s.Key,
s.Source,
s.Name,
s.Parts,
existing.Contains(s.Name)
)),
];
}
}