diff --git a/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs b/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs index f65bd4e1..2a2e5eab 100644 --- a/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs +++ b/AsbCloudDb/Model/DefaultData/EntityNotificationCategory.cs @@ -4,6 +4,6 @@ public class EntityNotificationCategory : EntityFiller { public override NotificationCategory[] GetData() => new NotificationCategory[] { - new() { Id = 1, Name = "Системные уведомления" } + new() { Id = NotificationCategory.IdSystemNotificationCategory, Name = "Системные уведомления" } }; } \ No newline at end of file diff --git a/AsbCloudDb/Model/NotificationCategory.cs b/AsbCloudDb/Model/NotificationCategory.cs index 3da37e30..879b59d8 100644 --- a/AsbCloudDb/Model/NotificationCategory.cs +++ b/AsbCloudDb/Model/NotificationCategory.cs @@ -8,7 +8,13 @@ namespace AsbCloudDb.Model; [Table("t_notification_category"), Comment("Категории уведомлений")] public class NotificationCategory : IId { - [Key] + #region constants category notifications ids + /// + /// СИСТЕМНЫЕ УВЕДОМЛЕНИЯ + /// + public const int IdSystemNotificationCategory = 1; + + [Key] [Column("id")] public int Id { get; set; } diff --git a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs index c91689a3..c7fc2f5d 100644 --- a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs +++ b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs @@ -35,7 +35,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram private readonly BackgroundWorker backgroundWorker; private readonly NotificationService notificationService; - private const int idNotificationCategory = 20000; private const int idTransportType = 1; private const int idFileCategoryDrillingProgram = 1000; @@ -398,7 +397,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType @@ -422,7 +421,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType @@ -442,7 +441,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType diff --git a/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs b/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs index 8ac7c15c..7a736ba9 100644 --- a/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs +++ b/AsbCloudInfrastructure/Services/WellFinalDocumentsService.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using AsbCloudApp.Services.Notifications; +using AsbCloudDb.Model; namespace AsbCloudInfrastructure.Services { @@ -136,7 +137,6 @@ namespace AsbCloudInfrastructure.Services private async Task SendMessageAsync(WellDto well, UserDto user, string documentCategory, string message, CancellationToken cancellationToken) { - const int idNotificationCategory = 20000; const int idTransportType = 1; var factory = new WellFinalDocumentMailBodyFactory(configuration); @@ -151,7 +151,7 @@ namespace AsbCloudInfrastructure.Services await notificationService.NotifyAsync(new NotifyRequest { IdUser = user.Id, - IdNotificationCategory = idNotificationCategory, + IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory, Title = subject, Message = body, IdTransportType = idTransportType