mirror of https://github.com/ErsatzTV/ErsatzTV.git
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.
25 lines
1.0 KiB
25 lines
1.0 KiB
using System.Collections.Generic; |
|
using System.Threading; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using LanguageExt; |
|
using MediatR; |
|
using static ErsatzTV.Application.ProgramSchedules.Mapper; |
|
|
|
namespace ErsatzTV.Application.ProgramSchedules.Queries |
|
{ |
|
public class GetProgramScheduleItemsHandler : IRequestHandler<GetProgramScheduleItems, |
|
Option<IEnumerable<ProgramScheduleItemViewModel>>> |
|
{ |
|
private readonly IProgramScheduleRepository _programScheduleRepository; |
|
|
|
public GetProgramScheduleItemsHandler(IProgramScheduleRepository programScheduleRepository) => |
|
_programScheduleRepository = programScheduleRepository; |
|
|
|
public Task<Option<IEnumerable<ProgramScheduleItemViewModel>>> Handle( |
|
GetProgramScheduleItems request, |
|
CancellationToken cancellationToken) => |
|
_programScheduleRepository.GetItems(request.Id) |
|
.MapT(programScheduleItems => programScheduleItems.Map(ProjectToViewModel)); |
|
} |
|
}
|
|
|