using PnvPanel.Application.Common.Interfaces; using PnvPanel.Application.Common.Messaging; using PnvPanel.Application.Common.Models; namespace PnvPanel.Application.Support.ListSelectableRoles; public sealed class ListSelectableRolesQueryHandler(IRoleService roleService) : IQueryHandler>> { // Совпадает со значением Infrastructure.Identity.RoleNames.Admin — см. пояснение в // CreateRoleRequestTicketCommandHandler (Application не может ссылаться на Infrastructure). private const string AdminRoleName = "admin"; public async Task>> Handle(ListSelectableRolesQuery query, CancellationToken cancellationToken) { var roles = await roleService.ListRolesAsync(cancellationToken); var selectable = roles.Where(r => !r.Name.Equals(AdminRoleName, StringComparison.OrdinalIgnoreCase)).ToList(); return Result.Success>(selectable); } }