Files
ersatztv/ErsatzTV.Application/Scheduling/Queries/GetDecosByDecoGroupIdHandler.cs
T
Jason DoveandGitHub 19fc068a73 add deco system (#1665)
* add deco groups and decos; set default deco for block playout

* use block playout default deco for watermark

* add deco templates, groups and deco template editor

* associate deco template with playout template

* use deco template item watermark for playback

* update changelog for decos
2024-04-04 14:38:56 -05:00

22 lines
801 B
C#

using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetDecosByDecoGroupIdHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetDecosByDecoGroupId, List<DecoViewModel>>
{
public async Task<List<DecoViewModel>> Handle(GetDecosByDecoGroupId request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<Deco> decos = await dbContext.Decos
.Filter(b => b.DecoGroupId == request.DecoGroupId)
.AsNoTracking()
.ToListAsync(cancellationToken);
return decos.Map(Mapper.ProjectToViewModel).ToList();
}
}