feat: core entities, infrastructure, and lead repositories

- 25 domain entities mapped from original Datos/ classes
- 4 enums (EstadoLead, TipoPago, TipoDocumento, TipoDescuento)
- DTOs for Lead, Auth flows
- 6 repository interfaces
- VentasDbContext with EF Core + Npgsql
- LeadRepository (command SPs) and LeadQueryRepository (query SPs) with Dapper
- Program.cs with JWT auth, CORS, DI setup
- appsettings.json with connection string
- .gitignore for bin/obj/node_modules
- ROADMAP.md for daily progress tracking
This commit is contained in:
2026-07-07 17:45:49 -04:00
commit 3d5419403d
54 changed files with 2424 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Ventas.Infrastructure.Data;
using Ventas.Infrastructure.Repositories;
using Ventas.Core.Interfaces;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("Default")!;
builder.Services.AddControllers();
builder.Services.AddOpenApi();
builder.Services.AddDbContext<VentasDbContext>(options =>
options.UseNpgsql(connectionString));
builder.Services.AddScoped<ILeadRepository>(sp =>
new LeadRepository(connectionString));
builder.Services.AddScoped<ILeadQueryRepository>(sp =>
new LeadQueryRepository(connectionString));
var jwtSecret = builder.Configuration["Jwt:Secret"] ?? "default-dev-secret-change-in-production";
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = false,
ValidateAudience = false,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSecret))
};
});
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod();
});
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();