Browse Source

add content-type with notification definition

pull/696/head
cKey 3 years ago
parent
commit
b77d1a5573
  1. 49
      aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/CosClientFactory.cs
  2. 4
      aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/AbstractTencentCloudClientFactory.cs
  3. 3
      aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/TencentCloudClientFactory.cs
  4. 21
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationContentType.cs
  5. 6
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationDefinition.cs
  6. 2
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs
  7. 2
      aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationInfo.cs
  8. 4
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs
  9. 3
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs
  10. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs
  11. 1
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs
  12. 3
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/DynamicNotificationDefinitionCache.cs
  13. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs
  14. 8
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationDefinitionRecord.cs
  15. 3
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationDefinitionsCacheItem.cs
  16. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs
  17. 1
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/UserNotificationInfo.cs
  18. 7
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs
  19. 9
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs
  20. 14
      aspnet-core/modules/pushplus/LINGYUN.Abp.Notifications.PushPlus/LINGYUN/Abp/Notifications/NotificationDefinitionExtensions.cs
  21. 9
      aspnet-core/modules/wx-pusher/LINGYUN.Abp.Notifications.WxPusher/LINGYUN/Abp/Notifications/NotificationDefinitionExtensions.cs
  22. 4
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs
  23. 735
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220915102817_Add-ContentType-With-Notification-Definition.Designer.cs
  24. 37
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220915102817_Add-ContentType-With-Notification-Definition.cs
  25. 10
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs
  26. 1
      aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider.cs
  27. 5
      aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider_Tests.cs

49
aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/CosClientFactory.cs

@ -2,10 +2,10 @@
using COSXML.Auth;
using LINGYUN.Abp.Tencent;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings;
namespace LINGYUN.Abp.BlobStoring.Tencent;
@ -14,14 +14,14 @@ public class CosClientFactory : AbstractTencentCloudClientFactory<CosXml, Tencen
ICosClientFactory,
ITransientDependency
{
private readonly static object _clientCacheSync = new();
protected IBlobContainerConfigurationProvider ConfigurationProvider { get; }
public CosClientFactory(
IMemoryCache clientCache,
ICurrentTenant currentTenant,
ISettingProvider settingProvider,
IBlobContainerConfigurationProvider configurationProvider)
: base(clientCache, currentTenant, settingProvider)
: base(clientCache, settingProvider)
{
ConfigurationProvider = configurationProvider;
}
@ -35,17 +35,36 @@ public class CosClientFactory : AbstractTencentCloudClientFactory<CosXml, Tencen
protected override CosXml CreateClient(TencentBlobProviderConfiguration configuration, TencentCloudClientCacheItem cloudCache)
{
var configBuilder = new CosXmlConfig.Builder();
configBuilder
.SetAppid(configuration.AppId)
.SetRegion(configuration.Region);
var cred = new DefaultQCloudCredentialProvider(
cloudCache.SecretId,
cloudCache.SecretKey,
cloudCache.DurationSecond);
// TODO: 推荐全局单个对象,需要解决缓存过期事件
return new CosXmlServer(configBuilder.Build(), cred);
// 推荐全局单个对象,需要解决缓存过期事件
var cacheKey = TencentCloudClientCacheItem.CalculateCacheKey("client-instance");
var cosXmlCache = ClientCache.Get<CosXmlServer>(cacheKey);
if (cosXmlCache == null)
{
lock(_clientCacheSync)
{
if (cosXmlCache == null)
{
var configBuilder = new CosXmlConfig.Builder();
configBuilder
.SetAppid(configuration.AppId)
.SetRegion(configuration.Region);
var cred = new DefaultQCloudCredentialProvider(
cloudCache.SecretId,
cloudCache.SecretKey,
cloudCache.DurationSecond);
cosXmlCache = new CosXmlServer(configBuilder.Build(), cred);
ClientCache.Set(
cacheKey,
cosXmlCache,
// 会话持续时间前60秒过期
TimeSpan.FromSeconds(cloudCache.DurationSecond - 60));
}
}
}
return cosXmlCache;
}
}

4
aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/AbstractTencentCloudClientFactory.cs

@ -31,7 +31,7 @@ public abstract class AbstractTencentCloudClientFactory<TClient>
protected async virtual Task<TencentCloudClientCacheItem> GetClientCacheItemAsync()
{
return await ClientCache.GetOrCreateAsync(
TencentCloudClientCacheItem.CalculateCacheKey("client"),
TencentCloudClientCacheItem.CalculateCacheKey("client-options"),
async (_) =>
{
var secretId = await SettingProvider.GetOrNullAsync(TencentCloudSettingNames.SecretId);
@ -87,7 +87,7 @@ public abstract class AbstractTencentCloudClientFactory<TClient, TConfiguration>
protected async virtual Task<TencentCloudClientCacheItem> GetClientCacheItemAsync()
{
return await ClientCache.GetOrCreateAsync(
TencentCloudClientCacheItem.CalculateCacheKey("client"),
TencentCloudClientCacheItem.CalculateCacheKey("client-options"),
async (_) =>
{
var secretId = await SettingProvider.GetOrNullAsync(TencentCloudSettingNames.SecretId);

3
aspnet-core/modules/cloud-tencent/LINGYUN.Abp.Tencent/LINGYUN/Abp/Tencent/TencentCloudClientFactory.cs

@ -12,9 +12,8 @@ public class TencentCloudClientFactory<TClient> : AbstractTencentCloudClientFact
{
public TencentCloudClientFactory(
IMemoryCache clientCache,
ICurrentTenant currentTenant,
ISettingProvider settingProvider)
: base(clientCache, currentTenant, settingProvider)
: base(clientCache, settingProvider)
{
}

21
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationContentType.cs

@ -0,0 +1,21 @@
namespace LINGYUN.Abp.Notifications;
public enum NotificationContentType
{
/// <summary>
/// 文本
/// </summary>
Text = 0,
/// <summary>
/// Html
/// </summary>
Html = 1,
/// <summary>
/// Markdown
/// </summary>
Markdown = 2,
/// <summary>
/// Json
/// </summary>
Json = 3
}

6
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationDefinition.cs

@ -46,6 +46,10 @@ namespace LINGYUN.Abp.Notifications
/// 通知类型
/// </summary>
public NotificationType NotificationType { get; set; }
/// <summary>
/// 通知内容类型
/// </summary>
public NotificationContentType ContentType { get; set; }
/// <summary>
/// 通知提供者
/// </summary>
@ -66,6 +70,7 @@ namespace LINGYUN.Abp.Notifications
ILocalizableString description = null,
NotificationType notificationType = NotificationType.Application,
NotificationLifetime lifetime = NotificationLifetime.Persistent,
NotificationContentType contentType = NotificationContentType.Text,
bool allowSubscriptionToClients = false)
{
Name = name;
@ -73,6 +78,7 @@ namespace LINGYUN.Abp.Notifications
Description = description;
NotificationLifetime = lifetime;
NotificationType = notificationType;
ContentType = contentType;
AllowSubscriptionToClients = allowSubscriptionToClients;
Providers = new List<string>();

2
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationGroupDefinition.cs

@ -58,6 +58,7 @@ namespace LINGYUN.Abp.Notifications
ILocalizableString description = null,
NotificationType notificationType = NotificationType.Application,
NotificationLifetime lifetime = NotificationLifetime.Persistent,
NotificationContentType contentType = NotificationContentType.Text,
bool allowSubscriptionToClients = false)
{
var notification = new NotificationDefinition(
@ -66,6 +67,7 @@ namespace LINGYUN.Abp.Notifications
description,
notificationType,
lifetime,
contentType,
allowSubscriptionToClients
);

2
aspnet-core/modules/common/LINGYUN.Abp.Notifications.Core/LINGYUN/Abp/Notifications/NotificationInfo.cs

@ -11,12 +11,14 @@ namespace LINGYUN.Abp.Notifications
public DateTime CreationTime { get; set; }
public NotificationLifetime Lifetime { get; set; }
public NotificationType Type { get; set; }
public NotificationContentType ContentType { get; set; }
public NotificationSeverity Severity { get; set; }
public NotificationInfo()
{
Data = new NotificationData();
Lifetime = NotificationLifetime.Persistent;
Type = NotificationType.Application;
ContentType = NotificationContentType.Text;
Severity = NotificationSeverity.Info;
CreationTime = DateTime.Now;

4
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application.Contracts/LINGYUN/Abp/MessageService/Notifications/Dto/NotificationDto.cs

@ -24,5 +24,9 @@ namespace LINGYUN.Abp.MessageService.Notifications
/// 通知类型
/// </summary>
public NotificationType Type { get; set; }
/// <summary>
/// 通知内容类型
/// </summary>
public NotificationContentType ContentType { get; set; }
}
}

3
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/Notifications/NotificationAppService.cs

@ -60,7 +60,8 @@ namespace LINGYUN.Abp.MessageService.Notifications
DisplayName = notification.DisplayName.Localize(StringLocalizerFactory),
Description = notification.Description?.Localize(StringLocalizerFactory) ?? notification.Name,
Lifetime = notification.NotificationLifetime,
Type = notification.NotificationType
Type = notification.NotificationType,
ContentType = notification.ContentType
};
notificationGroup.Notifications.Add(notificationChildren);

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs

@ -22,6 +22,7 @@ namespace LINGYUN.Abp.MessageService.Mapper
.ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName))
.ForMember(dto => dto.Lifetime, map => map.Ignore())
.ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type))
.ForMember(dto => dto.ContentType, map => map.MapFrom(src => src.ContentType))
.ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity))
.ForMember(dto => dto.CreationTime, map => map.MapFrom(src => src.CreationTime))
.ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) =>
@ -41,6 +42,7 @@ namespace LINGYUN.Abp.MessageService.Mapper
.ForMember(dto => dto.Name, map => map.MapFrom(src => src.Name))
.ForMember(dto => dto.Lifetime, map => map.Ignore())
.ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type))
.ForMember(dto => dto.ContentType, map => map.MapFrom(src => src.ContentType))
.ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity))
.ForMember(dto => dto.CreationTime, map => map.MapFrom(src => src.CreationTime))
.ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) =>

1
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/NotificationTypeConverter.cs

@ -15,6 +15,7 @@ namespace LINGYUN.Abp.MessageService.Mapper
{
Name = source.NotificationName,
Type = source.Type,
ContentType = source.ContentType,
Severity = source.Severity,
CreationTime = source.CreationTime,
TenantId = source.TenantId

3
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/DynamicNotificationDefinitionCache.cs

@ -86,6 +86,7 @@ public class DynamicNotificationDefinitionCache : IDynamicNotificationDefinition
new FixedLocalizableString(notification.Description),
notification.NotificationType,
notification.Lifetime,
notification.ContentType,
notification.AllowSubscriptionToClients);
notificationDefine.Properties.AddIfNotContains(notification.Properties);
@ -117,6 +118,7 @@ public class DynamicNotificationDefinitionCache : IDynamicNotificationDefinition
new FixedLocalizableString(notification.Description),
notification.NotificationType,
notification.Lifetime,
notification.ContentType,
notification.AllowSubscriptionToClients);
notificationDefinition.WithProviders(notification.Providers.ToArray());
@ -288,6 +290,7 @@ public class DynamicNotificationDefinitionCache : IDynamicNotificationDefinition
description,
record.NotificationLifetime,
record.NotificationType,
record.ContentType,
providers,
record.AllowSubscriptionToClients);
recordCache.Properties.AddIfNotContains(record.ExtraProperties);

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/Notification.cs

@ -12,6 +12,7 @@ namespace LINGYUN.Abp.MessageService.Notifications
public virtual Guid? TenantId { get; protected set; }
public virtual NotificationSeverity Severity { get; protected set; }
public virtual NotificationType Type { get; set; }
public virtual NotificationContentType ContentType { get; set; }
public virtual long NotificationId { get; protected set; }
public virtual string NotificationName { get; protected set; }
public virtual string NotificationTypeName { get; protected set; }
@ -43,6 +44,7 @@ namespace LINGYUN.Abp.MessageService.Notifications
NotificationName = name;
NotificationTypeName = dataType;
Type = NotificationType.Application;
ContentType = NotificationContentType.Text;
TenantId = tenantId;
SetData(data);

8
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationDefinitionRecord.cs

@ -59,6 +59,10 @@ public class NotificationDefinitionRecord : BasicAggregateRoot<Guid>, IHasExtraP
/// </summary>
public virtual NotificationType NotificationType { get; set; }
/// <summary>
/// 通知内容类型
/// </summary>
public virtual NotificationContentType ContentType { get; set; }
/// <summary>
/// 通知提供者
/// </summary>
/// <remarks>
@ -86,7 +90,8 @@ public class NotificationDefinitionRecord : BasicAggregateRoot<Guid>, IHasExtraP
string resourceName = null,
string localization = null,
NotificationLifetime lifetime = NotificationLifetime.Persistent,
NotificationType notificationType = NotificationType.Application)
NotificationType notificationType = NotificationType.Application,
NotificationContentType contentType = NotificationContentType.Text)
: base(id)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), NotificationDefinitionRecordConsts.MaxNameLength);
@ -95,6 +100,7 @@ public class NotificationDefinitionRecord : BasicAggregateRoot<Guid>, IHasExtraP
Description = Check.Length(description, nameof(description), NotificationDefinitionRecordConsts.MaxDescriptionLength);
NotificationLifetime = lifetime;
NotificationType = notificationType;
ContentType = contentType;
SetLocalization(resourceName, localization);

3
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationDefinitionsCacheItem.cs

@ -38,6 +38,7 @@ public class NotificationDefinitionCacheItem
public string Description { get; set; }
public NotificationLifetime Lifetime { get; set; }
public NotificationType NotificationType { get; set; }
public NotificationContentType ContentType { get; set; }
public List<string> Providers { get; set; }
public bool AllowSubscriptionToClients { get; set; }
public Dictionary<string, object> Properties { get; set; }
@ -54,6 +55,7 @@ public class NotificationDefinitionCacheItem
string description = null,
NotificationLifetime lifetime = NotificationLifetime.Persistent,
NotificationType notificationType = NotificationType.Application,
NotificationContentType contentType = NotificationContentType.Text,
List<string> providers = null,
bool allowSubscriptionToClients = false)
{
@ -63,6 +65,7 @@ public class NotificationDefinitionCacheItem
Description = description;
Lifetime = lifetime;
NotificationType = notificationType;
ContentType = contentType;
Providers = providers ?? new List<string>();
AllowSubscriptionToClients = allowSubscriptionToClients;

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs

@ -329,7 +329,7 @@ namespace LINGYUN.Abp.MessageService.Notifications
{
CreationTime = _clock.Now,
Type = notification.Type,
// TODO: 通知过期时间应该可以配置
ContentType = notification.ContentType,
ExpirationTime = _clock.Now.Add(_options.ExpirationTime)
};

1
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/UserNotificationInfo.cs

@ -13,6 +13,7 @@ public class UserNotificationInfo
public string NotificationTypeName { get; set; }
public DateTime CreationTime { get; set; }
public NotificationType Type { get; set; }
public NotificationContentType ContentType { get; set; }
public NotificationSeverity Severity { get; set; }
public NotificationReadState State { get; set; }
}

7
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/EntityFrameworkCore/MessageServiceDbContextModelCreatingExtensions.cs

@ -2,6 +2,7 @@
using LINGYUN.Abp.MessageService.Groups;
using LINGYUN.Abp.MessageService.Notifications;
using LINGYUN.Abp.MessageService.Subscriptions;
using LINGYUN.Abp.Notifications;
using Microsoft.EntityFrameworkCore;
using System;
using Volo.Abp;
@ -29,6 +30,9 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore
b.Property(p => p.NotificationTypeName).HasMaxLength(NotificationConsts.MaxTypeNameLength).IsRequired();
//b.Property(p => p.NotificationData).HasMaxLength(NotificationConsts.MaxDataLength).IsRequired();
b.Property(p => p.ContentType)
.HasDefaultValue(NotificationContentType.Text);
b.ConfigureByConvention();
b.HasIndex(p => new { p.TenantId, p.NotificationName });
@ -229,6 +233,9 @@ namespace LINGYUN.Abp.MessageService.EntityFrameworkCore
b.Property(p => p.Providers)
.HasMaxLength(NotificationDefinitionRecordConsts.MaxProvidersLength);
b.Property(p => p.ContentType)
.HasDefaultValue(NotificationContentType.Text);
b.ConfigureByConvention();
});
}

9
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs

@ -57,7 +57,8 @@ namespace LINGYUN.Abp.MessageService.Notifications
NotificationTypeName = n.NotificationTypeName,
Severity = n.Severity,
State = un.ReadStatus,
Type = n.Type
Type = n.Type,
ContentType = n.ContentType
};
return await notifilerQuery
@ -98,7 +99,8 @@ namespace LINGYUN.Abp.MessageService.Notifications
NotificationTypeName = n.NotificationTypeName,
Severity = n.Severity,
State = un.ReadStatus,
Type = n.Type
Type = n.Type,
ContentType = n.ContentType
};
return await notifilerQuery
@ -166,7 +168,8 @@ namespace LINGYUN.Abp.MessageService.Notifications
NotificationTypeName = n.NotificationTypeName,
Severity = n.Severity,
State = un.ReadStatus,
Type = n.Type
Type = n.Type,
ContentType = n.ContentType
};
return await notifilerQuery

14
aspnet-core/modules/pushplus/LINGYUN.Abp.Notifications.PushPlus/LINGYUN/Abp/Notifications/NotificationDefinitionExtensions.cs

@ -1,6 +1,5 @@
using LINGYUN.Abp.PushPlus.Channel;
using LINGYUN.Abp.PushPlus.Message;
using System;
namespace LINGYUN.Abp.Notifications;
public static class NotificationDefinitionExtensions
@ -17,7 +16,7 @@ public static class NotificationDefinitionExtensions
/// <returns></returns>
public static NotificationDefinition WithTemplate(
this NotificationDefinition notification,
PushPlusMessageTemplate template = PushPlusMessageTemplate.Text)
PushPlusMessageTemplate template = PushPlusMessageTemplate.Html)
{
return notification.WithProperty(TemplateKey, template);
}
@ -29,7 +28,7 @@ public static class NotificationDefinitionExtensions
/// <returns></returns>
public static PushPlusMessageTemplate GetTemplateOrDefault(
this NotificationDefinition notification,
PushPlusMessageTemplate defaultTemplate = PushPlusMessageTemplate.Text)
PushPlusMessageTemplate defaultTemplate = PushPlusMessageTemplate.Html)
{
if (notification.Properties.TryGetValue(TemplateKey, out var defineTemplate) == true &&
defineTemplate is PushPlusMessageTemplate template)
@ -37,7 +36,14 @@ public static class NotificationDefinitionExtensions
return template;
}
return defaultTemplate;
return notification.ContentType switch
{
NotificationContentType.Text => PushPlusMessageTemplate.Text,
NotificationContentType.Html => PushPlusMessageTemplate.Html,
NotificationContentType.Markdown => PushPlusMessageTemplate.Markdown,
NotificationContentType.Json => PushPlusMessageTemplate.Json,
_ => defaultTemplate,
};
}
/// <summary>
/// 设定消息发送通道

9
aspnet-core/modules/wx-pusher/LINGYUN.Abp.Notifications.WxPusher/LINGYUN/Abp/Notifications/NotificationDefinitionExtensions.cs

@ -37,7 +37,14 @@ public static class NotificationDefinitionExtensions
return contentType;
}
return defaultContentType;
return notification.ContentType switch
{
NotificationContentType.Text => MessageContentType.Text,
NotificationContentType.Html => MessageContentType.Html,
NotificationContentType.Markdown => MessageContentType.Markdown,
NotificationContentType.Json => MessageContentType.Text,
_ => defaultContentType,
};
}
/// <summary>
/// 消息主题(Topic)

4
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Distributed/NotificationEventHandler.cs

@ -194,6 +194,7 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed
TenantId = tenantId,
Severity = eventData.Severity,
Type = notification.NotificationType,
ContentType = notification.ContentType,
CreationTime = eventData.CreationTime,
Lifetime = notification.NotificationLifetime,
};
@ -282,7 +283,8 @@ namespace LY.MicroService.RealtimeMessage.EventBus.Distributed
Severity = eventData.Severity,
Lifetime = notification.NotificationLifetime,
TenantId = tenantId,
Type = notification.NotificationType
Type = notification.NotificationType,
ContentType = notification.ContentType,
};
notificationInfo.SetId(eventData.Id);

735
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220915102817_Add-ContentType-With-Notification-Definition.Designer.cs

@ -0,0 +1,735 @@
// <auto-generated />
using System;
using LY.MicroService.RealtimeMessage.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace LY.MicroService.RealtimeMessage.Migrations
{
[DbContext(typeof(RealtimeMessageMigrationsDbContext))]
[Migration("20220915102817_Add-ContentType-With-Notification-Definition")]
partial class AddContentTypeWithNotificationDefinition
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "6.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<int>("Age")
.HasColumnType("int");
b.Property<string>("AvatarUrl")
.HasMaxLength(512)
.HasColumnType("varchar(512)");
b.Property<DateTime?>("Birthday")
.HasColumnType("datetime(6)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Description")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<DateTime?>("LastOnlineTime")
.HasColumnType("datetime(6)");
b.Property<string>("NickName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int>("Sex")
.HasColumnType("int");
b.Property<string>("Sign")
.HasMaxLength(30)
.HasColumnType("varchar(30)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId");
b.ToTable("AppUserChatCards", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<bool>("Black")
.HasColumnType("tinyint(1)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Description")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<bool>("DontDisturb")
.HasColumnType("tinyint(1)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<Guid>("FrientId")
.HasColumnType("char(36)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<string>("RemarkName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("SpecialFocus")
.HasColumnType("tinyint(1)");
b.Property<byte>("Status")
.HasColumnType("tinyint unsigned");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId", "FrientId");
b.ToTable("AppUserChatFriends", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<bool>("AllowAddFriend")
.HasColumnType("tinyint(1)");
b.Property<bool>("AllowAnonymous")
.HasColumnType("tinyint(1)");
b.Property<bool>("AllowReceiveMessage")
.HasColumnType("tinyint(1)");
b.Property<bool>("AllowSendMessage")
.HasColumnType("tinyint(1)");
b.Property<bool>("RequireAddFriendValition")
.HasColumnType("tinyint(1)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId");
b.ToTable("AppUserChatSettings", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(1048576)
.HasColumnType("longtext");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<long>("MessageId")
.HasColumnType("bigint");
b.Property<Guid>("ReceiveUserId")
.HasColumnType("char(36)");
b.Property<string>("SendUserName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("Source")
.HasColumnType("int");
b.Property<sbyte>("State")
.HasColumnType("tinyint");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TenantId", "ReceiveUserId");
b.ToTable("AppUserMessages", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("Address")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<Guid>("AdminUserId")
.HasColumnType("char(36)");
b.Property<bool>("AllowAnonymous")
.HasColumnType("tinyint(1)");
b.Property<bool>("AllowSendMessage")
.HasColumnType("tinyint(1)");
b.Property<string>("AvatarUrl")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("Description")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<long>("GroupId")
.HasColumnType("bigint");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int>("MaxUserCount")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("varchar(20)");
b.Property<string>("Notice")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Tag")
.HasMaxLength(512)
.HasColumnType("varchar(512)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AppChatGroups", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<long>("GroupId")
.HasColumnType("bigint");
b.Property<Guid>("ShieldUserId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "GroupId");
b.ToTable("AppGroupChatBlacks", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(1048576)
.HasColumnType("longtext");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<long>("GroupId")
.HasColumnType("bigint");
b.Property<long>("MessageId")
.HasColumnType("bigint");
b.Property<string>("SendUserName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("Source")
.HasColumnType("int");
b.Property<sbyte>("State")
.HasColumnType("tinyint");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TenantId", "GroupId");
b.ToTable("AppGroupMessages", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<long>("GroupId")
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId", "GroupId", "UserId");
b.ToTable("AppUserChatGroups", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsAdmin")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("NickName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<DateTime?>("SilenceEnd")
.HasColumnType("datetime(6)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId");
b.ToTable("AppUserGroupCards", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.Notification", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<int>("ContentType")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<DateTime?>("ExpirationTime")
.HasColumnType("datetime(6)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<long>("NotificationId")
.HasColumnType("bigint");
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<string>("NotificationTypeName")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("varchar(512)");
b.Property<sbyte>("Severity")
.HasColumnType("tinyint");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TenantId", "NotificationName");
b.ToTable("AppNotifications", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.NotificationDefinitionGroupRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<bool>("AllowSubscriptionToClients")
.HasColumnType("tinyint(1)");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("DisplayName")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("Localization")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ResourceName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.HasKey("Id");
b.ToTable("AppNotificationDefinitionGroups", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.NotificationDefinitionRecord", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<bool>("AllowSubscriptionToClients")
.HasColumnType("tinyint(1)");
b.Property<int>("ContentType")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("DisplayName")
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("GroupName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("Localization")
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("NotificationLifetime")
.HasColumnType("int");
b.Property<int>("NotificationType")
.HasColumnType("int");
b.Property<string>("Providers")
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property<string>("ResourceName")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.HasKey("Id");
b.ToTable("AppNotificationDefinitions", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Notifications.UserNotification", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<long>("NotificationId")
.HasColumnType("bigint");
b.Property<int>("ReadStatus")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId", "NotificationId")
.HasDatabaseName("IX_Tenant_User_Notification_Id");
b.ToTable("AppUserNotifications", (string)null);
});
modelBuilder.Entity("LINGYUN.Abp.MessageService.Subscriptions.UserSubscribe", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("UserName")
.IsRequired()
.ValueGeneratedOnAdd()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasDefaultValue("/");
b.HasKey("Id");
b.HasIndex("TenantId", "UserId", "NotificationName")
.IsUnique()
.HasDatabaseName("IX_Tenant_User_Notification_Name");
b.ToTable("AppUserSubscribes", (string)null);
});
#pragma warning restore 612, 618
}
}
}

37
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/20220915102817_Add-ContentType-With-Notification-Definition.cs

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LY.MicroService.RealtimeMessage.Migrations
{
public partial class AddContentTypeWithNotificationDefinition : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ContentType",
table: "AppNotifications",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ContentType",
table: "AppNotificationDefinitions",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ContentType",
table: "AppNotifications");
migrationBuilder.DropColumn(
name: "ContentType",
table: "AppNotificationDefinitions");
}
}
}

10
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Migrations/RealtimeMessageMigrationsDbContextModelSnapshot.cs

@ -519,6 +519,11 @@ namespace LY.MicroService.RealtimeMessage.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<int>("ContentType")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
@ -608,6 +613,11 @@ namespace LY.MicroService.RealtimeMessage.Migrations
b.Property<bool>("AllowSubscriptionToClients")
.HasColumnType("tinyint(1)");
b.Property<int>("ContentType")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("varchar(255)");

1
aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider.cs

@ -16,6 +16,7 @@
group.AddNotification(NotificationsTestsNames.Test3,
notificationType: NotificationType.User,
contentType: NotificationContentType.Markdown,
lifetime: NotificationLifetime.OnlyOne);
}
}

5
aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider_Tests.cs

@ -37,7 +37,7 @@ namespace LINGYUN.Abp.Notifications
}
[Theory]
[InlineData(NotificationsTestsNames.Test1)]
[InlineData(NotificationsTestsNames.Test3)]
public async Task Get_Test(string name)
{
var notification = await NotificationDefinitionManager.GetAsync(name);
@ -46,7 +46,8 @@ namespace LINGYUN.Abp.Notifications
notification.Description.ShouldBeNull();
notification.AllowSubscriptionToClients.ShouldBeFalse();
notification.NotificationLifetime.ShouldBe(NotificationLifetime.OnlyOne);
notification.NotificationType.ShouldBe(NotificationType.Application);
notification.NotificationType.ShouldBe(NotificationType.User);
notification.ContentType.ShouldBe(NotificationContentType.Markdown);
}
}
}

Loading…
Cancel
Save