1. Убрана категория уведомления с ключом 20000

2. Категория системных уведомлений спрятана в константу
This commit is contained in:
Olga Nemt 2023-12-19 12:28:41 +05:00
parent c924170a54
commit 3cf880832c
4 changed files with 13 additions and 8 deletions

View File

@ -4,6 +4,6 @@ public class EntityNotificationCategory : EntityFiller<NotificationCategory>
{
public override NotificationCategory[] GetData() => new NotificationCategory[]
{
new() { Id = 1, Name = "Системные уведомления" }
new() { Id = NotificationCategory.IdSystemNotificationCategory, Name = "Системные уведомления" }
};
}

View File

@ -8,6 +8,12 @@ namespace AsbCloudDb.Model;
[Table("t_notification_category"), Comment("Категории уведомлений")]
public class NotificationCategory : IId
{
#region constants category notifications ids
/// <summary>
/// СИСТЕМНЫЕ УВЕДОМЛЕНИЯ
/// </summary>
public const int IdSystemNotificationCategory = 1;
[Key]
[Column("id")]
public int Id { get; set; }

View File

@ -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

View File

@ -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