mirror of
https://github.com/farcasclaudiu/PracticeCalendar.git
synced 2026-06-22 07:01:16 +03:00
WIP refactoring
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PracticeCalendar.Domain.Common.Interfaces;
|
||||
using PracticeCalendar.Domain.Entities;
|
||||
using PracticeCalendar.Domain.Entities.Specifications;
|
||||
|
||||
namespace PracticeCalendar.Application.PracticeEvents.Queries.GetPracticeEvents
|
||||
{
|
||||
public record class GetPracticeEventsQuery : IRequest<List<PracticeEvent>>
|
||||
{
|
||||
}
|
||||
|
||||
public class GetPracticeEventsQueryHandler : IRequestHandler<GetPracticeEventsQuery, List<PracticeEvent>>
|
||||
{
|
||||
private readonly ILogger<GetPracticeEventsQueryHandler> logger;
|
||||
private readonly IRepository<PracticeEvent> eventsRepo;
|
||||
|
||||
public GetPracticeEventsQueryHandler(IRepository<PracticeEvent> eventsRepo,
|
||||
ILogger<GetPracticeEventsQueryHandler> logger)
|
||||
{
|
||||
this.eventsRepo = eventsRepo;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public async Task<List<PracticeEvent>> Handle(GetPracticeEventsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var spec = new PracticeEventsWithAttendees();
|
||||
var evList = await eventsRepo.ListAsync(spec);
|
||||
return evList;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user