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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user