Merge pull request 'Убрана категория уведомлений с ключом 20000' (#175) from fix/#26023175--id-system-category-notification into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/175
This commit is contained in:
Никита Фролов 2023-12-19 16:05:03 +05:00
commit d7c80c0d5c
4 changed files with 15 additions and 9 deletions

View File

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

View File

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

View File

@ -35,7 +35,6 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
private readonly BackgroundWorker backgroundWorker; private readonly BackgroundWorker backgroundWorker;
private readonly NotificationService notificationService; private readonly NotificationService notificationService;
private const int idNotificationCategory = 20000;
private const int idTransportType = 1; private const int idTransportType = 1;
private const int idFileCategoryDrillingProgram = 1000; private const int idFileCategoryDrillingProgram = 1000;
@ -377,7 +376,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
await notificationService.NotifyAsync(new NotifyRequest await notificationService.NotifyAsync(new NotifyRequest
{ {
IdUser = user.Id, IdUser = user.Id,
IdNotificationCategory = idNotificationCategory, IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory,
Title = subject, Title = subject,
Message = body, Message = body,
IdTransportType = idTransportType IdTransportType = idTransportType
@ -398,7 +397,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
await notificationService.NotifyAsync(new NotifyRequest await notificationService.NotifyAsync(new NotifyRequest
{ {
IdUser = user.Id, IdUser = user.Id,
IdNotificationCategory = idNotificationCategory, IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory,
Title = subject, Title = subject,
Message = body, Message = body,
IdTransportType = idTransportType IdTransportType = idTransportType
@ -422,7 +421,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
await notificationService.NotifyAsync(new NotifyRequest await notificationService.NotifyAsync(new NotifyRequest
{ {
IdUser = user.Id, IdUser = user.Id,
IdNotificationCategory = idNotificationCategory, IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory,
Title = subject, Title = subject,
Message = body, Message = body,
IdTransportType = idTransportType IdTransportType = idTransportType
@ -442,7 +441,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
await notificationService.NotifyAsync(new NotifyRequest await notificationService.NotifyAsync(new NotifyRequest
{ {
IdUser = user.Id, IdUser = user.Id,
IdNotificationCategory = idNotificationCategory, IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory,
Title = subject, Title = subject,
Message = body, Message = body,
IdTransportType = idTransportType IdTransportType = idTransportType

View File

@ -11,6 +11,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AsbCloudApp.Services.Notifications; using AsbCloudApp.Services.Notifications;
using AsbCloudDb.Model;
namespace AsbCloudInfrastructure.Services namespace AsbCloudInfrastructure.Services
{ {
@ -136,7 +137,6 @@ namespace AsbCloudInfrastructure.Services
private async Task SendMessageAsync(WellDto well, UserDto user, string documentCategory, string message, private async Task SendMessageAsync(WellDto well, UserDto user, string documentCategory, string message,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
const int idNotificationCategory = 20000;
const int idTransportType = 1; const int idTransportType = 1;
var factory = new WellFinalDocumentMailBodyFactory(configuration); var factory = new WellFinalDocumentMailBodyFactory(configuration);
@ -151,7 +151,7 @@ namespace AsbCloudInfrastructure.Services
await notificationService.NotifyAsync(new NotifyRequest await notificationService.NotifyAsync(new NotifyRequest
{ {
IdUser = user.Id, IdUser = user.Id,
IdNotificationCategory = idNotificationCategory, IdNotificationCategory = NotificationCategory.IdSystemNotificationCategory,
Title = subject, Title = subject,
Message = body, Message = body,
IdTransportType = idTransportType IdTransportType = idTransportType