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.
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
using LiteCqrs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TeleWave.Application.Common.Interfaces;
|
||||
|
||||
namespace TeleWave.Application.Programming.Groups.ListGroups;
|
||||
|
||||
public sealed class ListGroupsQueryHandler(IAppDbContext dbContext)
|
||||
: IQueryHandler<ListGroupsQuery, IReadOnlyList<GroupSummaryDto>>
|
||||
{
|
||||
public async Task<IReadOnlyList<GroupSummaryDto>> Handle(
|
||||
ListGroupsQuery query,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
// Список читает кэш статистики, не пересчитывая его: пересчёт идёт при правке состава.
|
||||
return await dbContext
|
||||
.Groups.AsNoTracking()
|
||||
.OrderBy(g => g.Name)
|
||||
.Select(g => new GroupSummaryDto(
|
||||
g.Id,
|
||||
g.Name,
|
||||
g.Description,
|
||||
g.ItemCount,
|
||||
g.UnitCount,
|
||||
g.TotalDuration.TotalSeconds,
|
||||
g.FilterJson != null,
|
||||
g.StatsComputedAt,
|
||||
g.CreatedAt
|
||||
))
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user