erp-platform/api/src/Kurs.Platform.DbMigrator/Seeds/NotificationRuleSeeder.cs
2025-05-06 14:03:45 +03:00

58 lines
2.1 KiB
C#

using System;
using System.Threading.Tasks;
using Kurs.Notifications.Domain;
using Kurs.Notifications.Entities;
using Kurs.Notifications.Enums;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Kurs.Platform.Data.Seeds;
public class NotificationRuleSeeder : IDataSeedContributor, ITransientDependency
{
private readonly IRepository<NotificationRule, Guid> _notificationRuleRepository;
public NotificationRuleSeeder(
IRepository<NotificationRule, Guid> notificationRuleRepository)
{
_notificationRuleRepository = notificationRuleRepository;
}
public async Task SeedAsync(DataSeedContext context)
{
#region NotificationRule
await _notificationRuleRepository.InsertManyAsync([
new() {
NotificationType = NotificationTypes.YeniSiparis,
RecipientType = NotificationRecipientTypes.Role,
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
Channel = NotificationChannels.UiActivity,
IsActive = true,
IsFixed = false,
IsCustomized = false
},
new() {
NotificationType = NotificationTypes.SiparisPasla,
RecipientType = NotificationRecipientTypes.Role,
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
Channel = NotificationChannels.Desktop,
IsActive = true,
IsFixed = false,
IsCustomized = false
},
new() {
NotificationType = NotificationTypes.YeniKullanici,
RecipientType = NotificationRecipientTypes.Role,
RecipientId = PlatformConsts.AbpIdentity.User.AdminRoleName,
Channel = NotificationChannels.Rocket,
IsActive = true,
IsFixed = false,
IsCustomized = false
},
]);
#endregion
}
}