Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
788 B

using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetAllDecoGroupsHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetAllDecoGroups, List<DecoGroupViewModel>>
{
public async Task<List<DecoGroupViewModel>> Handle(GetAllDecoGroups request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<DecoGroup> decoGroups = await dbContext.DecoGroups
.AsNoTracking()
.Include(g => g.Decos)
.ToListAsync(cancellationToken);
return decoGroups.Map(Mapper.ProjectToViewModel).ToList();
}
}