using Domain.Entities; using Features.UserManagement.Queries.GetAllUsers; using Features.UserManagement.Queries.GetUserById; using MediatR; using Microsoft.AspNetCore.Mvc; namespace Features.UserManagement.Controllers { /// /// Provides read-only endpoints for retrieving user accounts. /// /// Used to dispatch user queries to their handlers. [ApiController] [Route("api/[controller]")] public class UserController(IMediator mediator) : 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 mediator.Send(new GetAllUsersQuery(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 mediator.Send(new GetUserByIdQuery(id)); return Ok(user); } } }