fix: complete repository layer and refactor services

- Added ContratoRepository, CotizacionRepository, AlumnoRepository, UsuarioRepository (Infrastructure)
- Added IInformeRepository + InformeRepository for report SPs
- Refactored ContratoService, CotizacionService, AlumnoService, UsuarioService to use repos via DI
- Refactored InformeService, EmpresaReportService to use IInformeRepository
- Updated Program.cs DI to wire repos correctly with connection string factory
- Build: 0 errors
This commit is contained in:
2026-07-08 10:16:12 -04:00
parent df028eb4dd
commit 1b1baaf6bf
14 changed files with 465 additions and 522 deletions
+16 -7
View File
@@ -21,22 +21,31 @@ builder.Services.AddScoped<ILeadRepository>(sp =>
new LeadRepository(connectionString));
builder.Services.AddScoped<ILeadQueryRepository>(sp =>
new LeadQueryRepository(connectionString));
builder.Services.AddScoped<IContratoRepository>(sp =>
new ContratoRepository(connectionString));
builder.Services.AddScoped<ICotizacionRepository>(sp =>
new CotizacionRepository(connectionString));
builder.Services.AddScoped<IAlumnoRepository>(sp =>
new AlumnoRepository(connectionString));
builder.Services.AddScoped<IUsuarioRepository>(sp =>
new UsuarioRepository(connectionString));
builder.Services.AddScoped<IInformeRepository>(sp =>
new InformeRepository(connectionString));
builder.Services.AddScoped<LeadService>(sp =>
new LeadService(connectionString));
builder.Services.AddScoped<UsuarioService>(sp =>
new UsuarioService(connectionString));
new UsuarioService(sp.GetRequiredService<IUsuarioRepository>(), connectionString));
builder.Services.AddScoped<ContratoService>(sp =>
new ContratoService(connectionString));
new ContratoService(sp.GetRequiredService<IContratoRepository>(), connectionString));
builder.Services.AddScoped<CotizacionService>(sp =>
new CotizacionService(connectionString));
new CotizacionService(sp.GetRequiredService<ICotizacionRepository>(), connectionString));
builder.Services.AddScoped<AlumnoService>(sp =>
new AlumnoService(connectionString));
builder.Services.AddScoped<InformeService>(sp =>
new InformeService(connectionString));
new AlumnoService(sp.GetRequiredService<IAlumnoRepository>(), connectionString));
builder.Services.AddScoped<InformeService>();
builder.Services.AddScoped<ReportService>();
builder.Services.AddScoped<EmpresaReportService>(sp =>
new EmpresaReportService(connectionString));
new EmpresaReportService(sp.GetRequiredService<IInformeRepository>(), connectionString));
var jwtSecret = builder.Configuration["Jwt:Secret"] ?? "default-dev-secret-change-in-production";
var jwtExpiration = int.Parse(builder.Configuration["Jwt:ExpirationMinutes"] ?? "30");