Handler.cs 567 B

1234567891011121314151617181920
  1. using Application.Abstractions.Identity;
  2. using MediatR;
  3. namespace Application.Features.Director.Role.Get
  4. {
  5. public sealed class Handler(IIdentityRoleReader roleReader) : IRequestHandler<Query, Response>
  6. {
  7. public async Task<Response> Handle(Query request, CancellationToken ct)
  8. {
  9. var role = await roleReader.GetRoleAsync(request.ID, ct);
  10. return new Response
  11. {
  12. ID = role.ID,
  13. Name = role.Name,
  14. ClaimsCount = role.Claims.Count
  15. };
  16. }
  17. }
  18. }