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.");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
@Mercados.Api_HostAddress = http://localhost:5045
 | 
			
		||||
@Mercados.Api_HostAddress = http://192.168.10.78:5045
 | 
			
		||||
 | 
			
		||||
GET {{Mercados.Api_HostAddress}}/weatherforecast/
 | 
			
		||||
Accept: application/json
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
###
 | 
			
		||||
@@ -16,7 +16,7 @@ builder.Services.AddCors(options =>
 | 
			
		||||
    options.AddPolicy(name: MyAllowSpecificOrigins,
 | 
			
		||||
                      policy =>
 | 
			
		||||
                      {
 | 
			
		||||
                          policy.WithOrigins("http://localhost:5173") 
 | 
			
		||||
                          policy.WithOrigins("http://localhost:5173", "http://192.168.10.78:5173")
 | 
			
		||||
                                .AllowAnyHeader()
 | 
			
		||||
                                .AllowAnyMethod();
 | 
			
		||||
                      });
 | 
			
		||||
@@ -47,7 +47,6 @@ builder.Services
 | 
			
		||||
 | 
			
		||||
// Add services to the container.
 | 
			
		||||
builder.Services.AddControllers();
 | 
			
		||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 | 
			
		||||
builder.Services.AddEndpointsApiExplorer();
 | 
			
		||||
builder.Services.AddSwaggerGen();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": false,
 | 
			
		||||
      "applicationUrl": "http://localhost:5045",
 | 
			
		||||
      "applicationUrl": "http://0.0.0.0:5045",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
      }
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
      "commandName": "Project",
 | 
			
		||||
      "dotnetRunMessages": true,
 | 
			
		||||
      "launchBrowser": false,
 | 
			
		||||
      "applicationUrl": "https://localhost:7256;http://localhost:5045",
 | 
			
		||||
      "applicationUrl": "https://0.0.0.0:7256;http://0.0.0.0:5045",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user