Files
Cleanuparr/code/backend/Cleanuparr.Infrastructure/Features/Notifications/NotificationProvider.cs
2025-07-03 12:43:43 +03:00

35 lines
1.2 KiB
C#

using Cleanuparr.Infrastructure.Features.Notifications.Models;
using Cleanuparr.Persistence.Models.Configuration.Notification;
using Microsoft.EntityFrameworkCore;
namespace Cleanuparr.Infrastructure.Features.Notifications;
public abstract class NotificationProvider<T> : INotificationProvider<T>
where T : NotificationConfig
{
protected readonly DbSet<T> _notificationConfig;
protected T? _config;
public T Config => _config ??= _notificationConfig.AsNoTracking().First();
NotificationConfig INotificationProvider.Config => Config;
protected NotificationProvider(DbSet<T> notificationConfig)
{
_notificationConfig = notificationConfig;
}
public abstract string Name { get; }
public abstract Task OnFailedImportStrike(FailedImportStrikeNotification notification);
public abstract Task OnStalledStrike(StalledStrikeNotification notification);
public abstract Task OnSlowStrike(SlowStrikeNotification notification);
public abstract Task OnQueueItemDeleted(QueueItemDeletedNotification notification);
public abstract Task OnDownloadCleaned(DownloadCleanedNotification notification);
public abstract Task OnCategoryChanged(CategoryChangedNotification notification);
}