mirror of
https://github.com/farcasclaudiu/PracticeCalendar.git
synced 2026-06-22 07:01:16 +03:00
WIP refactoring
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PracticeCalendar.Domain\PracticeCalendar.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="PracticeEvents\Commands\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+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