Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
756 B

using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetBlockTreeHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetBlockTree, BlockTreeViewModel>
{
public async Task<BlockTreeViewModel> Handle(GetBlockTree request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<BlockGroup> blockGroups = await dbContext.BlockGroups
.AsNoTracking()
.Include(g => g.Blocks)
.ToListAsync(cancellationToken);
return Mapper.ProjectToViewModel(blockGroups);
}
}