Add user and role management features

This commit is contained in:
2026-08-18 15:43:55 +05:30
parent e0e691acbf
commit be51351f74
10 changed files with 386 additions and 0 deletions
@@ -0,0 +1,28 @@
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<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);
}
}