feat: Add visual summary cards for Agro/Grains and implement 24h time format
This commit is contained in:
@@ -12,12 +12,12 @@ namespace Mercados.Api.Controllers
|
||||
private readonly ICotizacionGranoRepository _granoRepo;
|
||||
private readonly ICotizacionGanadoRepository _ganadoRepo;
|
||||
private readonly ILogger<MercadosController> _logger;
|
||||
|
||||
|
||||
// Inyectamos TODOS los repositorios que necesita el controlador.
|
||||
public MercadosController(
|
||||
ICotizacionBolsaRepository bolsaRepo,
|
||||
ICotizacionGranoRepository granoRepo,
|
||||
ICotizacionGanadoRepository ganadoRepo,
|
||||
ICotizacionBolsaRepository bolsaRepo,
|
||||
ICotizacionGranoRepository granoRepo,
|
||||
ICotizacionGanadoRepository ganadoRepo,
|
||||
ILogger<MercadosController> logger)
|
||||
{
|
||||
_bolsaRepo = bolsaRepo;
|
||||
@@ -61,7 +61,7 @@ namespace Mercados.Api.Controllers
|
||||
return StatusCode(500, "Ocurrió un error interno en el servidor.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Endpoints de Bolsa ---
|
||||
[HttpGet("bolsa/eeuu")]
|
||||
[ProducesResponseType(typeof(IEnumerable<CotizacionBolsa>), StatusCodes.Status200OK)]
|
||||
@@ -96,5 +96,22 @@ namespace Mercados.Api.Controllers
|
||||
return StatusCode(500, "Ocurrió un error interno en el servidor.");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("bolsa/history/{ticker}")]
|
||||
[ProducesResponseType(typeof(IEnumerable<CotizacionBolsa>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<IActionResult> GetBolsaHistory(string ticker, [FromQuery] string mercado = "Local", [FromQuery] int dias = 30)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _bolsaRepo.ObtenerHistorialPorTickerAsync(ticker, mercado, dias);
|
||||
return Ok(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error al obtener historial para el ticker {Ticker}.", ticker);
|
||||
return StatusCode(500, "Ocurrió un error interno en el servidor.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user