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,65 @@
using LiteCqrs;
using Microsoft.EntityFrameworkCore;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;
namespace TeleWave.Application.Programming.Groups.GetGroup;
public sealed class GetGroupQueryHandler(IAppDbContext dbContext, GroupElementResolver resolver)
: IQueryHandler<GetGroupQuery, Result<GroupDto>>
{
public async Task<Result<GroupDto>> Handle(
GetGroupQuery query,
CancellationToken cancellationToken
)
{
var group = await dbContext
.Groups.AsNoTracking()
.Include(g => g.Items)
.FirstOrDefaultAsync(g => g.Id == query.Id, cancellationToken);
if (group is null)
return Result.Failure<GroupDto>(GroupErrors.NotFound);
var info = await resolver.ResolveAsync(
group.Items.Select(i => (i.ElementKind, i.ElementId)),
cancellationToken
);
var items = group
.Items.OrderBy(i => i.Position)
.Select(i =>
{
info.TryGetValue((i.ElementKind, i.ElementId), out var element);
return new GroupItemDto(
i.Id,
i.ElementKind,
i.ElementId,
// Элемент мог исчезнуть из библиотеки между чисткой и чтением — показываем прочерк,
// а не роняем весь экран группы.
element?.Name ?? "—",
i.Weight,
i.Position,
element?.UnitCount ?? 0,
element?.ShowKind,
element?.Audience,
element?.Year,
element?.PosterImageId
);
})
.ToList();
return Result.Success(
new GroupDto(
group.Id,
group.Name,
group.Description,
GroupFilter.FromJson(group.FilterJson),
group.ItemCount,
group.UnitCount,
group.TotalDuration.TotalSeconds,
group.StatsComputedAt,
items
)
);
}
}