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.

24 lines
786 B

using ErsatzTV.Application.Tree;
using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetDecoTreeHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetDecoTree, TreeViewModel>
{
public async Task<TreeViewModel> Handle(
GetDecoTree request,
CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<DecoGroup> deoGroups = await dbContext.DecoGroups
.AsNoTracking()
.Include(g => g.Decos)
.ToListAsync(cancellationToken);
return Mapper.ProjectToViewModel(deoGroups);
}
}