using MediatR; using Modules.User.Application.Models.Access; using Modules.User.Application.Repositories; namespace Modules.User.Application.Queries.Access; public class GetRoleQuery : IRequest { public int RoleId { get; init; } } public class GetRoleQueryHandler(IRoleQueries roleQueries) : IRequestHandler { public async Task Handle(GetRoleQuery request, CancellationToken cancellationToken) { // var accountId = userContext.GetAccountId(); // if (!accountId.HasValue) return []; // //TODO: if (!accountId.HasValue) throw new UnauthorizedAccessException("AccountId not found"); var role = await roleQueries.GetDetailByIdAsync(request.RoleId, cancellationToken); return role ?? throw new Exception("Role not found"); } }