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.

25 lines
872 B

using ErsatzTV.Application.Tree;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetDecoTemplateTreeHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetDecoTemplateTree, TreeViewModel>
{
public async Task<TreeViewModel> Handle(
GetDecoTemplateTree request,
CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<DecoTemplateGroup> templateGroups = await dbContext.DecoTemplateGroups
.AsNoTracking()
.Include(g => g.DecoTemplates)
.ToListAsync(cancellationToken);
return Mapper.ProjectToViewModel(templateGroups);
}
}