Files
ersatztv/ErsatzTV.Application/Scheduling/Queries/GetDecoByPlayoutIdHandler.cs
T
Jason DoveandGitHub 908125f8a9 allow selecting multiple watermarks on decos (#2287)
* load fonts on demand

* add new table

* populate new table

* edit and use multiple watermarks in deco

* remove old field

* update changelog
2025-08-09 17:00:12 +00:00

22 lines
893 B
C#

using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetDecoByPlayoutIdHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetDecoByPlayoutId, Option<DecoViewModel>>
{
public async Task<Option<DecoViewModel>> Handle(GetDecoByPlayoutId request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.Playouts
.AsNoTracking()
.Include(p => p.Deco)
.ThenInclude(d => d.DecoWatermarks)
.ThenInclude(d => d.Watermark)
.SelectOneAsync(p => p.Id, p => p.Id == request.PlayoutId && p.DecoId != null)
.MapT(p => Mapper.ProjectToViewModel(p.Deco));
}
}