Feat: Reforma de unificación de bases de datos.
This commit is contained in:
@@ -78,7 +78,7 @@ builder.Services.AddRateLimiter(options =>
|
|||||||
|
|
||||||
options.AddPolicy("AuthPolicy", context =>
|
options.AddPolicy("AuthPolicy", context =>
|
||||||
{
|
{
|
||||||
// 🟢 FIX: Si es localhost, SIN LÍMITES
|
// Si es localhost, SIN LÍMITES
|
||||||
var remoteIp = context.Connection.RemoteIpAddress;
|
var remoteIp = context.Connection.RemoteIpAddress;
|
||||||
if (System.Net.IPAddress.IsLoopback(remoteIp!))
|
if (System.Net.IPAddress.IsLoopback(remoteIp!))
|
||||||
{
|
{
|
||||||
@@ -97,11 +97,9 @@ builder.Services.AddRateLimiter(options =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// DB CONTEXTS
|
// DB CONTEXTS (Legacy unificado en eldia)
|
||||||
builder.Services.AddDbContext<InternetDbContext>(options =>
|
builder.Services.AddDbContext<EldiaDbContext>(options =>
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("Internet")));
|
options.UseSqlServer(builder.Configuration.GetConnectionString("eldia")));
|
||||||
builder.Services.AddDbContext<AutosDbContext>(options =>
|
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("Autos")));
|
|
||||||
builder.Services.AddDbContext<MotoresV2DbContext>(options =>
|
builder.Services.AddDbContext<MotoresV2DbContext>(options =>
|
||||||
options.UseSqlServer(builder.Configuration.GetConnectionString("MotoresV2"),
|
options.UseSqlServer(builder.Configuration.GetConnectionString("MotoresV2"),
|
||||||
sqlOptions => sqlOptions.EnableRetryOnFailure()));
|
sqlOptions => sqlOptions.EnableRetryOnFailure()));
|
||||||
|
|||||||
@@ -1,35 +1,29 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MotoresArgentinosV2.Core.DTOs;
|
||||||
using MotoresArgentinosV2.Core.Entities;
|
using MotoresArgentinosV2.Core.Entities;
|
||||||
|
|
||||||
namespace MotoresArgentinosV2.Infrastructure.Data;
|
namespace MotoresArgentinosV2.Infrastructure.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contexto de Entity Framework para la base de datos Autos (legacy)
|
/// Contexto de Entity Framework unificado para la base de datos 'eldia' (Legacy)
|
||||||
/// Servidor: TECNICA3
|
/// Contiene las tablas de avisos web, operaciones, medios de pago y lógica de usuarios legacy.
|
||||||
/// Base de Datos: autos
|
|
||||||
/// Propósito: Acceso a operaciones de pago y medios de pago
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AutosDbContext : DbContext
|
public class EldiaDbContext : DbContext
|
||||||
{
|
{
|
||||||
public AutosDbContext(DbContextOptions<AutosDbContext> options) : base(options)
|
public EldiaDbContext(DbContextOptions<EldiaDbContext> options) : base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// Tablas de la base 'autos' (ahora en eldia)
|
||||||
/// Tabla de operaciones de pago
|
|
||||||
/// </summary>
|
|
||||||
public DbSet<Operacion> Operaciones { get; set; }
|
public DbSet<Operacion> Operaciones { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tabla de medios de pago disponibles
|
|
||||||
/// </summary>
|
|
||||||
public DbSet<MedioDePago> MediosDePago { get; set; }
|
public DbSet<MedioDePago> MediosDePago { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
// Configuración para la tabla operaciones
|
// --- Configuración de tablas ex-Autos ---
|
||||||
|
|
||||||
modelBuilder.Entity<Operacion>(entity =>
|
modelBuilder.Entity<Operacion>(entity =>
|
||||||
{
|
{
|
||||||
entity.ToTable("operaciones");
|
entity.ToTable("operaciones");
|
||||||
@@ -67,7 +61,6 @@ public class AutosDbContext : DbContext
|
|||||||
entity.Property(e => e.Precioneto).HasColumnName("precioneto");
|
entity.Property(e => e.Precioneto).HasColumnName("precioneto");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Configuración para la tabla mediodepago
|
|
||||||
modelBuilder.Entity<MedioDePago>(entity =>
|
modelBuilder.Entity<MedioDePago>(entity =>
|
||||||
{
|
{
|
||||||
entity.ToTable("mediodepago");
|
entity.ToTable("mediodepago");
|
||||||
@@ -75,5 +68,18 @@ public class AutosDbContext : DbContext
|
|||||||
entity.Property(e => e.Id).HasColumnName("id");
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
entity.Property(e => e.Mediodepago).HasColumnName("mediodepago").HasMaxLength(20);
|
entity.Property(e => e.Mediodepago).HasColumnName("mediodepago").HasMaxLength(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// --- Configuración de DTOs Keyless de ex-Internet ---
|
||||||
|
|
||||||
|
modelBuilder.Entity<DatosAvisoDto>(e =>
|
||||||
|
{
|
||||||
|
e.HasNoKey();
|
||||||
|
e.ToView(null);
|
||||||
|
|
||||||
|
e.Property(p => p.ImporteSiniva).HasColumnType("decimal(18,2)");
|
||||||
|
e.Property(p => p.ImporteTotsiniva).HasColumnType("decimal(18,2)");
|
||||||
|
e.Property(p => p.PorcentajeCombinado).HasColumnType("decimal(18,2)");
|
||||||
|
e.Property(p => p.Centimetros).HasColumnType("decimal(18,2)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
// Backend/MotoresArgentinosV2.Infrastructure/Data/InternetDbContext.cs
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using MotoresArgentinosV2.Core.DTOs;
|
|
||||||
|
|
||||||
namespace MotoresArgentinosV2.Infrastructure.Data;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Contexto de Entity Framework para la base de datos Internet (legacy)
|
|
||||||
/// Servidor: ...
|
|
||||||
/// Base de Datos: internet
|
|
||||||
/// Propósito: Acceso a datos de avisos web
|
|
||||||
/// </summary>
|
|
||||||
public class InternetDbContext : DbContext
|
|
||||||
{
|
|
||||||
public InternetDbContext(DbContextOptions<InternetDbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
|
|
||||||
// Registrar el DTO como entidad sin llave (Keyless) para que SqlQueryRaw funcione bien
|
|
||||||
modelBuilder.Entity<DatosAvisoDto>(e =>
|
|
||||||
{
|
|
||||||
e.HasNoKey();
|
|
||||||
e.ToView(null); // No mapea a tabla
|
|
||||||
|
|
||||||
// Configurar precisión de decimales para silenciar warnings
|
|
||||||
e.Property(p => p.ImporteSiniva).HasColumnType("decimal(18,2)");
|
|
||||||
e.Property(p => p.ImporteTotsiniva).HasColumnType("decimal(18,2)");
|
|
||||||
e.Property(p => p.PorcentajeCombinado).HasColumnType("decimal(18,2)");
|
|
||||||
e.Property(p => p.Centimetros).HasColumnType("decimal(18,2)");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,10 +10,10 @@ namespace MotoresArgentinosV2.Infrastructure.Services;
|
|||||||
|
|
||||||
public class AvisosLegacyService : IAvisosLegacyService
|
public class AvisosLegacyService : IAvisosLegacyService
|
||||||
{
|
{
|
||||||
private readonly InternetDbContext _context;
|
private readonly EldiaDbContext _context;
|
||||||
private readonly ILogger<AvisosLegacyService> _logger;
|
private readonly ILogger<AvisosLegacyService> _logger;
|
||||||
|
|
||||||
public AvisosLegacyService(InternetDbContext context, ILogger<AvisosLegacyService> logger)
|
public AvisosLegacyService(EldiaDbContext context, ILogger<AvisosLegacyService> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class LegacyPaymentService : ILegacyPaymentService
|
|||||||
|
|
||||||
public LegacyPaymentService(IConfiguration config, MotoresV2DbContext v2Context, ILogger<LegacyPaymentService> logger)
|
public LegacyPaymentService(IConfiguration config, MotoresV2DbContext v2Context, ILogger<LegacyPaymentService> logger)
|
||||||
{
|
{
|
||||||
_internetConn = config.GetConnectionString("Internet") ?? "";
|
_internetConn = config.GetConnectionString("eldia") ?? "";
|
||||||
_v2Context = v2Context;
|
_v2Context = v2Context;
|
||||||
_config = config;
|
_config = config;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ namespace MotoresArgentinosV2.Infrastructure.Services;
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementación del servicio para interactuar con datos legacy de operaciones
|
/// Implementación del servicio para interactuar con datos legacy de operaciones
|
||||||
/// Utiliza AutosDbContext para acceder a tablas y ejecutar SPs de la DB 'autos'
|
/// Utiliza EldiaDbContext para acceder a tablas y ejecutar SPs de la DB 'eldia' (ex base de datos 'autos')
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OperacionesLegacyService : IOperacionesLegacyService
|
public class OperacionesLegacyService : IOperacionesLegacyService
|
||||||
{
|
{
|
||||||
private readonly AutosDbContext _context;
|
private readonly EldiaDbContext _context;
|
||||||
private readonly ILogger<OperacionesLegacyService> _logger;
|
private readonly ILogger<OperacionesLegacyService> _logger;
|
||||||
|
|
||||||
public OperacionesLegacyService(AutosDbContext context, ILogger<OperacionesLegacyService> logger)
|
public OperacionesLegacyService(EldiaDbContext context, ILogger<OperacionesLegacyService> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ namespace MotoresArgentinosV2.Infrastructure.Services;
|
|||||||
|
|
||||||
public class UsuariosLegacyService : IUsuariosLegacyService
|
public class UsuariosLegacyService : IUsuariosLegacyService
|
||||||
{
|
{
|
||||||
private readonly InternetDbContext _context;
|
private readonly EldiaDbContext _context;
|
||||||
private readonly ILogger<UsuariosLegacyService> _logger;
|
private readonly ILogger<UsuariosLegacyService> _logger;
|
||||||
|
|
||||||
public UsuariosLegacyService(InternetDbContext context, ILogger<UsuariosLegacyService> logger)
|
public UsuariosLegacyService(EldiaDbContext context, ILogger<UsuariosLegacyService> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|||||||
@@ -84,11 +84,10 @@ export default function HomePage() {
|
|||||||
<div className="relative z-10 text-center px-4 max-w-4xl animate-fade-in-up">
|
<div className="relative z-10 text-center px-4 max-w-4xl animate-fade-in-up">
|
||||||
{/* Título optimizado para móvil */}
|
{/* Título optimizado para móvil */}
|
||||||
<h1 className="text-4xl sm:text-5xl md:text-6xl lg:text-6xl xl:text-7xl font-black mb-4 md:mb-6 tracking-tighter leading-tight">
|
<h1 className="text-4xl sm:text-5xl md:text-6xl lg:text-6xl xl:text-7xl font-black mb-4 md:mb-6 tracking-tighter leading-tight">
|
||||||
ENCUENTRA TU <span className="text-gradient">PRÓXIMO</span> VEHÍCULO
|
ENCONTRÁ TU <span className="text-gradient">PRÓXIMO</span> VEHÍCULO
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm sm:text-base md:text-xl text-gray-400 mb-6 md:mb-10 max-w-2xl mx-auto font-light px-2">
|
<p className="text-sm sm:text-base md:text-xl text-gray-400 mb-6 md:mb-10 max-w-2xl mx-auto font-light px-2">
|
||||||
La plataforma más avanzada para la compra y venta de Automóviles y Motos en Argentina.
|
La web más avanzada para la compra y venta de Autos y Motos en Argentina.
|
||||||
Integración total con medios impresos y digitales.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* --- CONTENEDOR DEL BUSCADOR CON ref y onFocus --- */}
|
{/* --- CONTENEDOR DEL BUSCADOR CON ref y onFocus --- */}
|
||||||
|
|||||||
Reference in New Issue
Block a user