Files
ersatztv/ErsatzTV.Application/Scheduling/Queries/GetDecoByIdHandler.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

18 lines
680 B
C#

using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetDecoByIdHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetDecoById, Option<DecoViewModel>>
{
public async Task<Option<DecoViewModel>> Handle(GetDecoById request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.Decos
.SelectOneAsync(b => b.Id, b => b.Id == request.DecoId)
.MapT(Mapper.ProjectToViewModel);
}
}