* sort block tree views * fix naming validation for block scheduling * show deco group name in deco editor * show block group name in block editor * show template group name in template editor * show deco template group name in deco template editor * fix template rename crash * fix block rename crash * fix deco template rename crash
25 lines
786 B
C#
25 lines
786 B
C#
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);
|
|
}
|
|
}
|