feat(profile): implement ReadProfile query with MediatR

Added ReadProfile query and its handler using MediatR pattern to retrieve user profile by user ID via IProfileRepository.
This commit is contained in:
tekh 2025-07-24 11:40:20 +02:00
parent b25d4eb028
commit 14f5c73d43
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,22 @@
using MediatR;
using WorkFlow.Application.Contracts.Repositories;
namespace WorkFlow.Application.Profile;
public record ReadProfile(int UserId) : IRequest<Domain.Entities.Profile?>;
public class ReadProfileHandler : IRequestHandler<ReadProfile, Domain.Entities.Profile?>
{
private readonly IProfileRepository _repository;
public ReadProfileHandler(IProfileRepository repository)
{
_repository = repository;
}
public async Task<Domain.Entities.Profile?> Handle(ReadProfile request, CancellationToken cancellationToken)
{
var profile = await _repository.ReadAsync(request.UserId);
return profile;
}
}

View File

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="DigitalData.Core.Application" Version="3.2.0" />
<PackageReference Include="MediatR" Version="13.0.0" />
<PackageReference Include="UserManager.Application" Version="3.1.2" />
</ItemGroup>