2026-01-30 15:34:23 +00:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using DoliMiddlewareApi.Dtos.query;
|
|
|
|
|
using DoliMiddlewareApi.Services;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DoliMiddlewareApi.Controllers;
|
|
|
|
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/[controller]")]
|
2026-02-03 16:19:53 +00:00
|
|
|
[Authorize]
|
2026-01-30 15:34:23 +00:00
|
|
|
public class ClientsController(ClientService clientService) : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
[ProducesResponseType(typeof(List<ClientDto>), StatusCodes.Status200OK)]
|
|
|
|
|
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
|
|
|
|
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
|
|
|
|
|
public async Task<ActionResult<List<ClientDto>>> GetClientes(
|
|
|
|
|
[FromQuery] int limit = 50,
|
2026-02-03 16:19:53 +00:00
|
|
|
[FromQuery][Range(1, int.MaxValue)] int page = 1)
|
2026-01-30 15:34:23 +00:00
|
|
|
{
|
|
|
|
|
var clients = await clientService.GetClientsAsync(limit, page);
|
|
|
|
|
return Ok(clients);
|
|
|
|
|
}
|
2026-02-03 16:19:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-30 15:34:23 +00:00
|
|
|
}
|