Changes
Build and Push Docker Images / build (push) Successful in 2s

This commit is contained in:
2026-05-04 21:41:14 +03:00
parent 30370e0e90
commit 20b4127fda
17 changed files with 502 additions and 463 deletions
+14 -1
View File
@@ -1,10 +1,12 @@
using Azure.Identity;
using Api.Data;
using Api.Services;
using Api.Services.Contracts;
using Api.Settings;
using Microsoft.AspNetCore.Diagnostics;
using Serilog;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
DotNetEnv.Env.Load();
@@ -69,7 +71,10 @@ try
builder.Services.AddHttpClient<IRagApiClient, RagApiClient>();
builder.Services.AddHttpClient<IMatcherAiClient, MatcherAiClient>();
builder.Services.AddHttpClient<IJobTextExtractor, JobTextExtractor>();
builder.Services.AddSingleton<IMatcherRepository, SqlMatcherRepository>();
builder.Services.AddDbContext<CvMatcherDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("CvMatcherDb")
?? throw new InvalidOperationException("Connection string 'CvMatcherDb' is missing.")));
builder.Services.AddScoped<IMatcherRepository, EfMatcherRepository>();
builder.Services.AddScoped<ICvMatcherService, CvMatcherService>();
builder.Services.AddSingleton<IEmailService, EmailService>();
@@ -160,6 +165,14 @@ try
app.MapControllers();
app.MapGet("/health", () => Results.Ok(new { status = "ok", service = "cv-matcher-api", version = appVersion, timeUtc = DateTimeOffset.UtcNow }));
Log.Information("Running EfCore DbMigrations if any");
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<CvMatcherDbContext>();
db.Database.Migrate();
}
Log.Information("{Service} startup complete", "cv-matcher-api");
app.Run();
}