Mismo que anterior Commit

This commit is contained in:
2025-07-03 15:56:06 -03:00
parent 20b6babc37
commit 5e317ab304
9 changed files with 67 additions and 57 deletions

View File

@@ -1,19 +1,9 @@
using DotNetEnv;
using FluentMigrator.Runner;
using Mercados.Database.Migrations;
using Mercados.Infrastructure;
using Mercados.Infrastructure.Persistence;
using Mercados.Infrastructure.Persistence.Repositories;
using DotNetEnv.Configuration;
var envFilePath = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "../../../../../.env"));
// Cargamos el archivo .env desde la ruta explícita.
if (!Env.Load(envFilePath).Any())
{
Console.WriteLine($"ADVERTENCIA: No se pudo encontrar el archivo .env en la ruta: {envFilePath}");
}
using Mercados.Api.Utils;
var builder = WebApplication.CreateBuilder(args);
@@ -50,7 +40,14 @@ builder.Services
.ScanIn(typeof(CreateInitialTables).Assembly).For.Migrations())
.AddLogging(lb => lb.AddFluentMigratorConsole());
// Servicios del contenedor estándar (perfecto)
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
// Añadimos nuestro convertidor personalizado para manejar las fechas.
options.JsonSerializerOptions.Converters.Add(new UtcDateTimeConverter());
});
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();