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:
@@ -0,0 +1,17 @@
|
||||
using HrynCo.NotificationService.Worker.Services.EmailProcessing;
|
||||
using Hrynco.RabbitMq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace HrynCo.NotificationService.Worker.Services;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddNotificationWorkerServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IRabbitMqPublisher, RabbitMqPublisher>();
|
||||
services.AddScoped<IEmailTemplateService, EmailTemplateService>();
|
||||
services.AddScoped<IEmailTemplateRenderingService, EmailTemplateRenderingService>();
|
||||
services.AddScoped<ISendEmailService, SendEmailService>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user