refactor: modularize email processing logic and improve service structure

- Extract email template handling, rendering, and sending code into `Worker.Services` project.
- Introduce `EmailTemplateService`, `EmailTemplateRenderingService`, and `SendEmailService`.
- Simplify consumer logic by delegating to scoped services.
- Update project dependencies and package references accordingly.
This commit is contained in:
Anatolii Grynchuk
2026-05-14 22:15:15 +03:00
parent 0861e18cec
commit 25fb48ccf0
18 changed files with 394 additions and 174 deletions
+3 -4
View File
@@ -1,8 +1,7 @@
using HrynCo.NotificationService.DAL.EF;
using HrynCo.NotificationService.Services;
using HrynCo.NotificationService.Worker;
using HrynCo.NotificationService.Worker.Services;
using Hrynco.RabbitMq;
using Microsoft.Extensions.Options;
var builder = Host.CreateApplicationBuilder(args);
@@ -14,7 +13,7 @@ var appSettings = builder.Configuration
builder.Services.AddSingleton(appSettings);
builder.Services.AddNotificationDataAccess(appSettings.ConnectionString);
builder.Services.AddNotificationServices();
builder.Services.AddNotificationWorkerServices();
builder.Services.Configure<RabbitMqSettings>(
builder.Configuration.GetSection($"{AppSettings.SectionName}:RabbitMq"));
@@ -22,4 +21,4 @@ builder.Services.Configure<RabbitMqSettings>(
builder.Services.AddHostedService<SendEmailConsumer>();
var host = builder.Build();
host.Run();
host.Run();