* update block group editor * update playlist group editor * update template group editor * update deco group editor * update deco template group editor * update deco editor * update logs layout * update changelog
26 lines
872 B
C#
26 lines
872 B
C#
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);
|
|
}
|
|
}
|