24 lines
804 B
C#
24 lines
804 B
C#
|
|
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
|
|
|
|
namespace BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
|
|
|
|
public class GetNetworkTreeQueryHandler : IRequestHandler<GetNetworkTreeQuery, GetNetworkTreeResponseDto>
|
|
{
|
|
private readonly IApplicationContractContext _context;
|
|
|
|
public GetNetworkTreeQueryHandler(IApplicationContractContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<GetNetworkTreeResponseDto> Handle(GetNetworkTreeQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var response = await _context.NetworkMemberships.GetNetworkTreeAsync(
|
|
request.Adapt<GetNetworkTreeRequest>(),
|
|
cancellationToken: cancellationToken);
|
|
|
|
return response.Adapt<GetNetworkTreeResponseDto>();
|
|
}
|
|
}
|