using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Distribution.Features.Role; [ApiController] [Route("api/roles")] [Authorize] public class RoleController(RoleService service) : ControllerBase { [HttpGet] public async Task GetAll() => Ok(await service.GetAllAsync()); [HttpGet("{id:guid}")] public async Task GetById(Guid id) { var result = await service.GetByIdAsync(id); return result is null ? NotFound() : Ok(result); } [HttpGet("{id:guid}/permissions")] public async Task GetPermissions(Guid id) { var result = await service.GetPermissionsAsync(id); return result is null ? NotFound() : Ok(result); } }