First Commit

This commit is contained in:
Jorge Luis caudillo esparza
2026-05-09 16:36:57 -07:00
parent 96ad4c0d3e
commit d0c284d9c0
131 changed files with 4009 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using ADS.Helpers.NotifyCenter.Abstractions;
using ADS.Helpers.NotifyCenter.Models;
using ADS.Helpers.NotifyCenter.Providers;
using ADS.Helpers.NotifyCenter.Providers.Smtp;
using Microsoft.Extensions.DependencyInjection;
namespace ADS.Helpers.NotifyCenter.Extensions;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddAdsNotifyCenter(this IServiceCollection services)
{
services.AddOptions<NotifyCenterOptions>();
services.AddSingleton<INotifyCenter, NotifyCenter>();
// Default settings provider (replace later with tenant-aware provider)
services.AddSingleton<InMemoryNotificationSettingsProvider>();
services.AddSingleton<INotificationSettingsProvider>(sp => sp.GetRequiredService<InMemoryNotificationSettingsProvider>());
// Providers
services.AddSingleton<INotificationProvider, SmtpNotificationProvider>();
return services;
}
// Helper to configure SMTP quickly when using InMemoryNotificationSettingsProvider
public static IServiceCollection ConfigureAdsSmtp(this IServiceCollection services, SmtpOptions options, string? tenantId = null)
{
var sp = services.BuildServiceProvider();
var mem = sp.GetRequiredService<InMemoryNotificationSettingsProvider>();
mem.Set(options, tenantId);
return services;
}
}