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
848 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 GetTemplateTreeHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetTemplateTree, TreeViewModel>
{
public async Task<TreeViewModel> Handle(
GetTemplateTree request,
CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<TemplateGroup> templateGroups = await dbContext.TemplateGroups
.AsNoTracking()
.Include(g => g.Templates)
.ToListAsync(cancellationToken);
return Mapper.ProjectToViewModel(templateGroups);
}
}