Handler.cs 538 B

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