* add blocks, block groups * basic block and block item editing * add template groups and basic template editing (name) * add blocks to template calendar * edit playout templates * add calendar preview to playout templates * add basic block playout building * add mysql migration * update changelog
22 lines
798 B
C#
22 lines
798 B
C#
using ErsatzTV.Core.Domain.Scheduling;
|
|
using ErsatzTV.Infrastructure.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ErsatzTV.Application.Scheduling;
|
|
|
|
public class GetAllBlockGroupsHandler(IDbContextFactory<TvContext> dbContextFactory)
|
|
: IRequestHandler<GetAllBlockGroups, List<BlockGroupViewModel>>
|
|
{
|
|
public async Task<List<BlockGroupViewModel>> Handle(GetAllBlockGroups request, CancellationToken cancellationToken)
|
|
{
|
|
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
|
|
|
|
List<BlockGroup> blockGroups = await dbContext.BlockGroups
|
|
.AsNoTracking()
|
|
.Include(g => g.Blocks)
|
|
.ToListAsync(cancellationToken);
|
|
|
|
return blockGroups.Map(Mapper.ProjectToViewModel).ToList();
|
|
}
|
|
}
|