Add missing seasons endpoint and update metadata handling
ci / build-backend (push) Successful in 4m7s
ci / build-frontend (push) Successful in 41s
ci / tests (push) Successful in 2m4s
ci / sonar (push) Successful in 4m41s

Implemented a new endpoint to retrieve missing seasons for shows, enhancing the MetadataEndpoints class. Updated the IMetadataProvider interface to include a method for fetching season numbers. Adjusted the ShowSummaryDto to include other genres and modified the ListShowsQueryHandler to handle multiple genres. Enhanced the Omdb and Tmdb metadata providers to support season number retrieval. Updated frontend components to integrate missing seasons functionality, including API calls and UI elements for displaying missing seasons reports.
This commit is contained in:
Leonid Pershin
2026-07-27 02:40:09 +03:00
parent 07c43a6875
commit 986f7ff52d
17 changed files with 540 additions and 53 deletions
@@ -32,16 +32,11 @@ public sealed class ListShowsQueryHandler(IAppDbContext dbContext)
var shows = await filtered.OrderBy(s => s.Name).ToListAsync(cancellationToken);
// Названия только для основных жанров — в списке показывается один.
var primaryIds = shows
.Select(s => s.PrimaryGenreId)
.Where(id => id is not null)
.Select(id => id!.Value)
.Distinct()
.ToList();
// Названия всех проставленных жанров: основной показывается в колонке, прочие — под «…».
var genreIds = shows.SelectMany(s => s.Genres.Select(g => g.GenreId)).Distinct().ToList();
var genreNames = await dbContext
.Genres.AsNoTracking()
.Where(g => primaryIds.Contains(g.Id))
.Where(g => genreIds.Contains(g.Id))
.ToDictionaryAsync(g => g.Id, g => g.Name, cancellationToken);
// Имена ассетов нужны, чтобы распознать сезоны (номера в модели не хранятся).
@@ -81,7 +76,14 @@ public sealed class ListShowsQueryHandler(IAppDbContext dbContext)
s.PrimaryGenreId is { } primaryId
&& genreNames.TryGetValue(primaryId, out var g)
? g
: null
: null,
[
.. s
.Genres.Where(x => !x.IsPrimary)
.Select(x => genreNames.GetValueOrDefault(x.GenreId))
.OfType<string>()
.Order(StringComparer.OrdinalIgnoreCase),
]
);
})
.ToList();
@@ -15,8 +15,10 @@ public sealed record ShowSummaryDto(
int? Year,
bool HasPoster,
DateTimeOffset CreatedAt,
/// <summary>Название основного жанра — в списке показываем только его, остальные видны в карточке шоу.</summary>
string? PrimaryGenre = null
/// <summary>Название основного жанра — в списке колонка показывает его.</summary>
string? PrimaryGenre,
/// <summary>Названия прочих жанров — в списке прячутся под «…», полный набор правится в карточке шоу.</summary>
IReadOnlyList<string> OtherGenres
);
/// <summary>Жанр, проставленный шоу.</summary>