5cb32bee95
This reverts commit 9adfff48a7.
27 lines
720 B
C#
27 lines
720 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Distribution.Features.Role;
|
|
|
|
[ApiController]
|
|
[Route("api/roles")]
|
|
public class RoleController(RoleService service) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetAll() =>
|
|
Ok(await service.GetAllAsync());
|
|
|
|
[HttpGet("{id:guid}")]
|
|
public async Task<IActionResult> GetById(Guid id)
|
|
{
|
|
var result = await service.GetByIdAsync(id);
|
|
return result is null ? NotFound() : Ok(result);
|
|
}
|
|
|
|
[HttpGet("{id:guid}/permissions")]
|
|
public async Task<IActionResult> GetPermissions(Guid id)
|
|
{
|
|
var result = await service.GetPermissionsAsync(id);
|
|
return result is null ? NotFound() : Ok(result);
|
|
}
|
|
}
|