using Domain.Entities;
using Microsoft.AspNetCore.Mvc;
using Service.UserManagement.User;
namespace API.Core.Controllers
{
///
/// Provides read-only endpoints for retrieving user accounts.
///
/// Service used to query user account data.
[ApiController]
[Route("api/[controller]")]
public class UserController(IUserService userService) : ControllerBase
{
///
/// Retrieves a paginated list of user accounts.
///
/// The maximum number of user accounts to return, or null for no limit.
/// The number of user accounts to skip before returning results, or null for no offset.
/// A 200 OK result containing the collection of entities.
[HttpGet]
public async Task>> GetAll(
[FromQuery] int? limit,
[FromQuery] int? offset
)
{
var users = await userService.GetAllAsync(limit, offset);
return Ok(users);
}
///
/// Retrieves a single user account by its unique identifier.
///
/// The unique identifier of the user account to retrieve.
/// A 200 OK result containing the matching .
[HttpGet("{id:guid}")]
public async Task> GetById(Guid id)
{
var user = await userService.GetByIdAsync(id);
return Ok(user);
}
}
}