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
@@ -2,6 +2,7 @@ using LiteCqrs;
using Microsoft.EntityFrameworkCore;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;
using TeleWave.Application.Library.Collections;
namespace TeleWave.Application.Library.GetShow;
@@ -16,10 +17,28 @@ public sealed class GetShowQueryHandler(IAppDbContext dbContext)
var show = await dbContext
.Shows.AsNoTracking()
.Include(s => s.Episodes)
.Include(s => s.Genres)
.FirstOrDefaultAsync(s => s.Id == query.Id, cancellationToken);
if (show is null)
return Result.Failure<ShowDto>(ShowErrors.NotFound);
var genreIds = show.Genres.Select(g => g.GenreId).ToList();
var genreNames = await dbContext
.Genres.AsNoTracking()
.Where(g => genreIds.Contains(g.Id))
.Select(g => new { g.Id, g.Name, g.SortOrder })
.ToListAsync(cancellationToken);
var genreDtos = genreNames
.OrderByDescending(g => show.Genres.First(sg => sg.GenreId == g.Id).IsPrimary)
.ThenBy(g => g.SortOrder)
.Select(g => new ShowGenreDto(
g.Id,
g.Name,
show.Genres.First(sg => sg.GenreId == g.Id).IsPrimary
))
.ToList();
var episodes = show.Episodes.OrderBy(e => e.Position).ToList();
var assetIds = episodes.Select(e => e.MediaAssetId).ToList();
var assets = await dbContext
@@ -55,6 +74,19 @@ public sealed class GetShowQueryHandler(IAppDbContext dbContext)
})
.ToList();
var collections = await dbContext
.CollectionItems.AsNoTracking()
.Where(i => i.ShowId == show.Id)
.Join(
dbContext.Collections.AsNoTracking(),
item => item.CollectionId,
collection => collection.Id,
(item, collection) =>
new ShowCollectionRefDto(collection.Id, collection.Name, item.Position)
)
.OrderBy(c => c.Name)
.ToListAsync(cancellationToken);
return Result.Success(
new ShowDto(
show.Id,
@@ -67,7 +99,9 @@ public sealed class GetShowQueryHandler(IAppDbContext dbContext)
show.MetadataExternalId,
show.Year,
show.PosterImageId,
episodeDtos
episodeDtos,
genreDtos,
collections
)
);
}