Update scheduling parameters and refactor channel endpoints: extend HorizonDays to 7 and RetentionDays to 90 in appsettings.json. Consolidate channel-related endpoint logic by removing obsolete files and enhancing the ShowEndpoints with audience and genre management capabilities. Improve error handling and streamline command handlers for channel operations.
build / backend (push) Successful in 7m40s
build / frontend (push) Failing after 39s
tests / backend-tests (push) Successful in 6m9s

This commit is contained in:
Leonid Pershin
2026-07-26 13:32:13 +03:00
parent c4ef954dea
commit 66040a8841
272 changed files with 27944 additions and 8699 deletions
@@ -0,0 +1,68 @@
using LiteCqrs;
using Microsoft.EntityFrameworkCore;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;
namespace TeleWave.Application.Library.Collections.GetCollection;
public sealed class GetCollectionQueryHandler(IAppDbContext dbContext)
: IQueryHandler<GetCollectionQuery, Result<CollectionDto>>
{
public async Task<Result<CollectionDto>> Handle(
GetCollectionQuery query,
CancellationToken cancellationToken
)
{
var collection = await dbContext
.Collections.AsNoTracking()
.Include(c => c.Items)
.FirstOrDefaultAsync(c => c.Id == query.Id, cancellationToken);
if (collection is null)
return Result.Failure<CollectionDto>(CollectionErrors.NotFound);
var showIds = collection.Items.Select(i => i.ShowId).ToList();
var shows = await dbContext
.Shows.AsNoTracking()
.Where(s => showIds.Contains(s.Id))
.Select(s => new
{
s.Id,
s.Name,
s.Kind,
s.Audience,
s.Year,
s.PosterImageId,
EpisodeCount = s.Episodes.Count,
})
.ToDictionaryAsync(s => s.Id, cancellationToken);
var items = collection
.Items.OrderBy(i => i.Position)
.Select(i =>
{
shows.TryGetValue(i.ShowId, out var show);
return new CollectionItemDto(
i.ShowId,
i.Position,
show?.Name ?? "—",
show?.Kind ?? default,
show?.Audience ?? default,
show?.EpisodeCount ?? 0,
show?.Year,
show?.PosterImageId
);
})
.ToList();
return Result.Success(
new CollectionDto(
collection.Id,
collection.Name,
collection.Description,
collection.PosterImageId,
collection.CreatedAt,
items
)
);
}
}