feat: consume transactional email notifications
Add contract validation, SMTP delivery results, terminal failure context, neutral development seeding, and local Docker setup. Ref: IT-1033
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using HrynCo.NotificationService.DAL.EF;
|
||||
using HrynCo.NotificationService.DAL.EF;
|
||||
using HrynCo.NotificationService.Migrator;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
@@ -21,8 +23,8 @@ try
|
||||
var connectionString = ctx.Configuration["App:ConnectionString"]
|
||||
?? throw new InvalidOperationException("App:ConnectionString is not configured.");
|
||||
|
||||
services.AddDbContext<NotificationDbContext>(options =>
|
||||
options.UseNpgsql(connectionString));
|
||||
services.AddNotificationDataAccess(connectionString);
|
||||
services.AddScoped<DevelopmentDataSeeder>();
|
||||
})
|
||||
.Build();
|
||||
|
||||
@@ -32,6 +34,18 @@ try
|
||||
Log.Information("Applying migrations...");
|
||||
await db.Database.MigrateAsync();
|
||||
Log.Information("Migrations applied successfully.");
|
||||
|
||||
var environment = scope.ServiceProvider.GetRequiredService<IHostEnvironment>();
|
||||
if (environment.IsDevelopment())
|
||||
{
|
||||
string serviceName = host.Services.GetRequiredService<IConfiguration>()["DevelopmentSeed:ServiceName"]
|
||||
?? DevelopmentDataSeeder.DefaultServiceName;
|
||||
|
||||
Log.Information("Seeding development email configuration...");
|
||||
var seeder = scope.ServiceProvider.GetRequiredService<DevelopmentDataSeeder>();
|
||||
await seeder.SeedAsync(serviceName);
|
||||
Log.Information("Development email configuration is ready.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user