diff --git a/src/GreenHome.Domain/AlertCondition.cs b/src/GreenHome.Domain/AlertCondition.cs index f03f38c..a52df80 100644 --- a/src/GreenHome.Domain/AlertCondition.cs +++ b/src/GreenHome.Domain/AlertCondition.cs @@ -10,7 +10,7 @@ public sealed class AlertCondition public Device Device { get; set; } = null!; /// - /// نوع اعلان: Call = 0, SMS = 1 + /// نوع اعلان: Call = -1, SMS = 0, Relay1..4 = 1..4 /// public AlertNotificationType NotificationType { get; set; } @@ -80,8 +80,12 @@ public sealed class AlertRule public enum AlertNotificationType { - Call = 0, - SMS = 1 + Call = -1, + SMS = 0, + Relay1 = 1, + Relay2 = 2, + Relay3 = 3, + Relay4 = 4 } public enum AlertTimeType diff --git a/src/GreenHome.Infrastructure/Services/Alert/AlertService.cs b/src/GreenHome.Infrastructure/Services/Alert/AlertService.cs index 49bee0a..441d5fc 100644 --- a/src/GreenHome.Infrastructure/Services/Alert/AlertService.cs +++ b/src/GreenHome.Infrastructure/Services/Alert/AlertService.cs @@ -74,7 +74,9 @@ public sealed class AlertService : IAlertService // 4. Load enabled conditions var conditions = await _dbContext.AlertConditions .Include(c => c.Rules) - .Where(c => c.DeviceId == deviceId && c.IsEnabled) + .Where(c => c.DeviceId == deviceId && c.IsEnabled + && (c.NotificationType == AlertNotificationType.SMS + || c.NotificationType == AlertNotificationType.Call)) .ToListAsync(cancellationToken); if (!conditions.Any())