diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs index 171869ab..f342b620 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/Users/IUserAppService.cs @@ -12,6 +12,11 @@ namespace Lion.AbpPro.BasicManagement.Users /// Task> ListAsync(PagingUserListInput input); + /// + /// 分页查询用户 + /// + Task> ListAllAsync(PagingUserListInput input); + /// /// 用户导出列表 /// diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs index ea0a6a76..35097822 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs @@ -54,6 +54,23 @@ namespace Lion.AbpPro.BasicManagement.Users base.ObjectMapper.Map, List>(source)); } + public async Task> ListAllAsync(PagingUserListInput input) + { + var request = new GetIdentityUsersInput + { + Filter = input.Filter?.Trim(), + MaxResultCount = input.PageSize, + SkipCount = input.SkipCount, + Sorting = nameof(IHasModificationTime.LastModificationTime) + }; + + var source = await _identityUserRepository + .GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter); + + return ObjectMapper.Map, List>(source); + + } + /// /// 用户导出列表 /// diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs index d0a8a817..e124f839 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/UserController.cs @@ -19,6 +19,14 @@ namespace Lion.AbpPro.BasicManagement.Systems { return _userAppService.ListAsync(input); } + + [HttpPost("list")] + [SwaggerOperation(summary: "分页获取用户信息", Tags = new[] { "Users" })] + public Task> ListAllAsync(PagingUserListInput input) + { + return _userAppService.ListAllAsync(input); + } + [HttpPost("export")] [SwaggerOperation(summary: "导出用户列表", Tags = new[] { "Users" })] [ProducesResponseType(typeof(FileContentResult), (int)HttpStatusCode.OK)] diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs index c5671406..a46adda3 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Hubs/INotificationHubAppService.cs @@ -2,5 +2,5 @@ public interface INotificationHubAppService : IApplicationService { - Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, List users); + Task SendMessageAsync(Guid id, string title, string content, MessageType messageType,MessageLevel messageLevel, string receiverUserId); } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs new file mode 100644 index 00000000..d851adfd --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationInput.cs @@ -0,0 +1,56 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos +{ + public class PagingNotificationInput : PagingBase + { + /// + /// 标题 + /// + public string Title { get; set; } + + + /// + /// 内容 + /// + public string Content { get; set; } + + /// + /// 发送者Id + /// + public Guid? SenderUserId { get; set; } + + /// + /// 发送者名称 + /// + public string SenderUserName { get; set; } + + /// + /// 接受者Id + /// + public Guid? ReceiverUserId { get; set; } + + /// + /// 接受者名称 + /// + public string ReceiverUserName { get; set; } + + /// + /// 是否已读 + /// + public bool? Read { get; set; } + + /// + /// 已读开始时间 + /// + public DateTime? StartReadTime { get; set; } + + /// + /// 已读结束时间 + /// + public DateTime? EndReadTime { get; set; } + + /// + /// 消息类型 + /// + public MessageType? MessageType { get; set; } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListInput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListInput.cs deleted file mode 100644 index 379ec87e..00000000 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListInput.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos -{ - public class PagingNotificationListInput:PagingBase - { - - } -} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListOutput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListOutput.cs deleted file mode 100644 index c83d6c03..00000000 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationListOutput.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos -{ - public class PagingNotificationListOutput - { - public Guid Id { get; set; } - - /// - /// 消息标题 - /// - public string Title { get; set; } - - /// - /// 消息内容 - /// - public string Content { get; set; } - - /// - /// 消息类型 - /// - public MessageType MessageType { get; set; } - - public string MessageTypeDescription => MessageType.ToDescription(); - - /// - /// 消息等级 - /// - public MessageLevel MessageLevel { get; set; } - - public string MessageLevelDescription => MessageLevel.ToDescription(); - - /// - /// 发送人 - /// - public Guid SenderId { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 是否已读 - /// - public bool Read { get; set; } - } -} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs new file mode 100644 index 00000000..f908d897 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationOutput.cs @@ -0,0 +1,70 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos +{ + public class PagingNotificationOutput + { + public Guid Id { get; set; } + + /// + /// 租户id + /// + public Guid? TenantId { get; set; } + + /// + /// 消息标题 + /// + public string Title { get; set; } + + /// + /// 消息内容 + /// + public string Content { get; set; } + + /// + /// 消息类型 + /// + public MessageType MessageType { get; set; } + + public string MessageTypeName => MessageType.ToDescription(); + + /// + /// 消息等级 + /// + public MessageLevel MessageLevel { get; set; } + public string MessageLevelName => MessageLevel.ToDescription(); + + /// + /// 发送人 + /// + public Guid SenderUserId { get; set; } + + /// + /// 发送人用户名 + /// + public string SenderUserName { get; set; } + + /// + /// 订阅人 + /// 消息类型是广播消息时,订阅人为空 + /// + public Guid? ReceiveUserId { get; set; } + + + /// + /// 接收人用户名 + /// 消息类型是广播消息时,订接收人用户名为空 + /// + public string ReceiveUserName { get; set; } + + /// + /// 是否已读 + /// + public bool Read { get; set; } + + /// + /// 已读时间 + /// + public DateTime? ReadTime { get; set; } + + public DateTime CreationTime { get; set; } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionInput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionInput.cs new file mode 100644 index 00000000..a1ef5873 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionInput.cs @@ -0,0 +1,34 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos +{ + public class PagingNotificationSubscriptionInput : PagingBase + { + + public Guid NotificationId { get; set; } + + + /// + /// 接受者Id + /// + public Guid? ReceiverUserId { get; set; } + + /// + /// 接受者名称 + /// + public string ReceiverUserName { get; set; } + + /// + /// 是否已读 + /// + public bool? Read { get; set; } + + /// + /// 已读开始时间 + /// + public DateTime? StartReadTime { get; set; } + + /// + /// 已读结束时间 + /// + public DateTime? EndReadTime { get; set; } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs new file mode 100644 index 00000000..ee6d7ae5 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/PagingNotificationSubscriptionOutput.cs @@ -0,0 +1,70 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos +{ + public class PagingNotificationSubscriptionOutput + { + public Guid Id { get; set; } + + /// + /// 租户id + /// + public Guid? TenantId { get; set; } + + /// + /// 消息Id + /// + public Guid NotificationId { get; set; } + + /// + /// 接收人id + /// + public Guid ReceiveUserId { get; set; } + + /// + /// 接收人用户名 + /// + public string ReceiveUserName { get; set; } + + /// + /// 是否已读 + /// + public bool Read { get; set; } + + /// + /// 已读时间 + /// + public DateTime ReadTime { get; set; } + + /// + /// 消息标题 + /// + public string Title { get; set; } + + /// + /// 消息内容 + /// + public string Content { get; set; } + + /// + /// 消息类型 + /// + public MessageType MessageType { get; set; } + + public string MessageTypeName => MessageType.ToDescription(); + + /// + /// 消息等级 + /// + public MessageLevel MessageLevel { get; set; } + public string MessageLevelName => MessageLevel.ToDescription(); + + /// + /// 发送人 + /// + public Guid SenderUserId { get; set; } + + /// + /// 发送人用户名 + /// + public string SenderUserName { get; set; } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendCommonMessageInput.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendCommonMessageInput.cs index 0632d0ac..279b258f 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendCommonMessageInput.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/Dtos/SendCommonMessageInput.cs @@ -15,12 +15,13 @@ public class SendCommonMessageInput : IValidatableObject /// /// 发送人 /// - public List ReceiveIds { get; set; } + public Guid ReceiveUserId { get; set; } - public SendCommonMessageInput() - { - ReceiveIds = new List(); - } + /// + /// 发送人名称 + /// + public string ReceiveUserName { get; set; } + public IEnumerable Validate(ValidationContext validationContext) { @@ -35,10 +36,5 @@ public class SendCommonMessageInput : IValidatableObject { yield return new ValidationResult(localization[NotificationManagementErrorCodes.MessageContent], new[] { nameof(Content) }); } - - if (ReceiveIds == null || ReceiveIds.Count == 0) - { - yield return new ValidationResult(localization[NotificationManagementErrorCodes.ReceiverNotNull], new[] { nameof(ReceiveIds) }); - } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs index 846e8c4b..e8b0def2 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs @@ -1,8 +1,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications { - public interface INotificationAppService:IApplicationService + public interface INotificationAppService : IApplicationService { - /// /// 发送警告文本消息 /// @@ -32,28 +31,17 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// 发送错误广播消息 /// Task SendBroadCastErrorMessageAsync(SendBroadCastMessageInput input); - + /// /// 消息设置为已读 /// - /// - /// Task SetReadAsync(SetReadInput input); - - /// - /// 分页获取用户普通文本消息 - /// - /// - /// - Task> GetPageCommonNotificationByUserIdAsync( - PagingNotificationListInput listInput); /// - /// 分页获取广播消息 + /// 分页获取消息 /// - /// - /// - Task> GetPageBroadCastNotificationByUserIdAsync( - PagingNotificationListInput listInput); + Task> PageNotificationAsync(PagingNotificationInput input); + + Task> PageNotificationSubscriptionAsync(PagingNotificationSubscriptionInput input); } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissionDefinitionProvider.cs index 06a314b6..7574c90a 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissionDefinitionProvider.cs @@ -4,7 +4,9 @@ namespace Lion.AbpPro.NotificationManagement.Permissions { public override void Define(IPermissionDefinitionContext context) { - var myGroup = context.AddGroup(NotificationManagementPermissions.GroupName, L("Permission:NotificationManagement")); + var abpIdentityGroup = context.GetGroup("AbpIdentity"); + var notificationManagement = abpIdentityGroup.AddPermission(NotificationManagementPermissions.NotificationManagement.Default, L("Permission:NotificationManagement")); + var notificationSubscriptionManagement = abpIdentityGroup.AddPermission(NotificationManagementPermissions.NotificationSubscriptionManagement.Default, L("Permission:NotificationSubscriptionManagement")); } private static LocalizableString L(string name) diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissions.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissions.cs index 534eed57..6f05baa4 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissions.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application.Contracts/Permissions/NotificationManagementPermissions.cs @@ -2,8 +2,25 @@ namespace Lion.AbpPro.NotificationManagement.Permissions { public class NotificationManagementPermissions { - public const string GroupName = "NotificationManagement"; + public const string GroupName = "AbpIdentity"; + + public static class NotificationManagement + { + public const string Default = GroupName + ".NotificationManagement"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } + + public static class NotificationSubscriptionManagement + { + public const string Default = GroupName + ".NotificationSubscriptionManagement"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + } + public static string[] GetAll() { return ReflectionHelper.GetPublicConstantsRecursively(typeof(NotificationManagementPermissions)); diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs index d0598f8f..349df398 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Hubs/NotificationHubAppService.cs @@ -20,12 +20,12 @@ public class NotificationHubAppService : NotificationManagementAppService, INoti /// /// 发送消息 /// - public virtual async Task SendMessageAsync(Guid id, string title, string content, MessageType messageType, MessageLevel messageLevel, List users) + public virtual async Task SendMessageAsync(Guid id, string title, string content, MessageType messageType, MessageLevel messageLevel, string receiverUserId) { switch (messageType) { case MessageType.Common: - await SendMessageToClientByUserIdAsync(new SendNotificationDto(id, title, content, messageType, messageLevel), users); + await SendMessageToClientByUserIdAsync(new SendNotificationDto(id, title, content, messageType, messageLevel), receiverUserId); break; case MessageType.BroadCast: await SendMessageToAllClientAsync(new SendNotificationDto(id, title, content, messageType, messageLevel)); @@ -38,14 +38,14 @@ public class NotificationHubAppService : NotificationManagementAppService, INoti /// /// 发送消息指定客户端用户 /// - private async Task SendMessageToClientByUserIdAsync(SendNotificationDto sendNotificationDto, List users) + private async Task SendMessageToClientByUserIdAsync(SendNotificationDto sendNotificationDto, string receiverUserId) { - if (users is { Count: > 0 }) + if (receiverUserId.IsNotNullOrWhiteSpace()) { await _hubContext.Clients - .Users(users.AsReadOnly().ToList()) + .Users(new string[] { receiverUserId }) .ReceiveTextMessageAsync(sendNotificationDto); - _logger.LogInformation($"通知模块收到消息:{_jsonSerializer.Serialize(sendNotificationDto)},发送给:{_jsonSerializer.Serialize(users)}"); + _logger.LogInformation($"通知模块收到消息:{_jsonSerializer.Serialize(sendNotificationDto)},发送给:{receiverUserId}"); } else { diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/NotificationManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/NotificationManagementApplicationAutoMapperProfile.cs index 44df2be0..7eea8871 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/NotificationManagementApplicationAutoMapperProfile.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/NotificationManagementApplicationAutoMapperProfile.cs @@ -7,8 +7,14 @@ namespace Lion.AbpPro.NotificationManagement /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - CreateMap() - .ForMember(dest => dest.Read, opt => opt.MapFrom(e => e.NotificationSubscriptions.FirstOrDefault().Read)); + CreateMap(); + CreateMap() + .ForMember(dest => dest.Title, opt => opt.Ignore()) + .ForMember(dest => dest.Content, opt => opt.Ignore()) + .ForMember(dest => dest.MessageType, opt => opt.Ignore()) + .ForMember(dest => dest.MessageLevel, opt => opt.Ignore()) + .ForMember(dest => dest.SenderUserId, opt => opt.Ignore()) + .ForMember(dest => dest.SenderUserName, opt => opt.Ignore()); } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs index 471fafd8..51eb9485 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/LocalEventHandlers/NotificationCreatedLocalEventHandler.cs @@ -22,7 +22,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.LocalEventHandlers eventData.NotificationEto.Content, eventData.NotificationEto.MessageType, eventData.NotificationEto.MessageLevel, - eventData.NotificationEto.NotificationSubscriptions.Select(e => e.ReceiveId.ToString()).ToList()); + eventData.NotificationEto.ReceiveUserId.ToString()); } } diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs index ac42b027..7a834c94 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Application/Notifications/NotificationAppService.cs @@ -1,18 +1,18 @@ +using System.Security.Authentication; + namespace Lion.AbpPro.NotificationManagement.Notifications { [Authorize] public class NotificationAppService : NotificationManagementAppService, INotificationAppService { private readonly INotificationManager _notificationManager; - private readonly ICurrentUser _currentUser; + private readonly INotificationSubscriptionManager _notificationSubscriptionManager; - public NotificationAppService( - INotificationManager notificationManager, - ICurrentUser currentUser) + public NotificationAppService(INotificationManager notificationManager, INotificationSubscriptionManager notificationSubscriptionManager) { _notificationManager = notificationManager; - _currentUser = currentUser; + _notificationSubscriptionManager = notificationSubscriptionManager; } @@ -21,7 +21,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendCommonWarningMessageAsync(SendCommonMessageInput input) { - await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, input.ReceiveIds); + await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Warning, input.ReceiveUserId, input.ReceiveUserName); } /// @@ -29,7 +29,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendCommonInformationMessageAsync(SendCommonMessageInput input) { - await _notificationManager.SendCommonInformationMessageAsync(input.Title, input.Content, input.ReceiveIds); + await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Information, input.ReceiveUserId, input.ReceiveUserName); } /// @@ -37,7 +37,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendCommonErrorMessageAsync(SendCommonMessageInput input) { - await _notificationManager.SendCommonErrorMessageAsync(input.Title, input.Content, input.ReceiveIds); + await _notificationManager.SendCommonWarningMessageAsync(input.Title, input.Content, MessageLevel.Error, input.ReceiveUserId, input.ReceiveUserName); } /// @@ -45,7 +45,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendBroadCastWarningMessageAsync(SendBroadCastMessageInput input) { - await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content); + await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Warning); } /// @@ -53,7 +53,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendBroadCastInformationMessageAsync(SendBroadCastMessageInput input) { - await _notificationManager.SendBroadCastInformationMessageAsync(input.Title, input.Content); + await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Information); } /// @@ -61,40 +61,72 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// public virtual async Task SendBroadCastErrorMessageAsync(SendBroadCastMessageInput input) { - await _notificationManager.SendBroadCastErrorMessageAsync(input.Title, input.Content); + await _notificationManager.SendBroadCastWarningMessageAsync(input.Title, input.Content, MessageLevel.Error); } - public virtual Task SetReadAsync(SetReadInput input) + public virtual async Task SetReadAsync(SetReadInput input) { - return _notificationManager.SetReadAsync(input.Id); + var notification = await _notificationManager.FindAsync(input.Id); + + if (notification == null) + { + throw new UserFriendlyException("消息不存在"); + } + + if (notification.MessageType == MessageType.Common) + { + await _notificationManager.SetReadAsync(input.Id); + } + else + { + if (!CurrentUser.IsAuthenticated) + { + throw new AuthenticationException(); + } + + await _notificationSubscriptionManager.SetReadAsync(CurrentUser.Id.Value, CurrentUser.UserName, input.Id); + } } - + /// - /// 分页获取用户普通文本消息 + /// 分页获取消息 /// - public virtual async Task> GetPageCommonNotificationByUserIdAsync(PagingNotificationListInput listInput) + public virtual async Task> PageNotificationAsync(PagingNotificationInput input) { - if (_currentUser == null || !_currentUser.Id.HasValue) - { - return null; - } - - var totalCount = await _notificationManager.GetPagingCountAsync(_currentUser.Id.Value, MessageType.Common); - var list = await _notificationManager.GetPagingListAsync(_currentUser.Id.Value, MessageType.Common, listInput.PageSize, listInput.SkipCount); - return new PagedResultDto(totalCount, ObjectMapper.Map, List>(list)); + var totalCount = await _notificationManager.GetPagingCountAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType); + var list = await _notificationManager.GetPagingListAsync(input.Title, input.Content, input.SenderUserId, input.SenderUserName, input.ReceiverUserId, input.ReceiverUserName, input.Read, input.StartReadTime, input.EndReadTime, input.MessageType, input.PageSize, input.SkipCount); + return new PagedResultDto(totalCount, ObjectMapper.Map, List>(list)); } /// - /// 分页获取广播消息 + /// 分页获取消息 /// - /// - /// - public virtual async Task> GetPageBroadCastNotificationByUserIdAsync(PagingNotificationListInput listInput) + public virtual async Task> PageNotificationSubscriptionAsync(PagingNotificationSubscriptionInput input) { - var totalCount = await _notificationManager.GetPagingCountAsync(null, MessageType.Common); - var list = await _notificationManager.GetPagingListAsync(null, MessageType.BroadCast, listInput.PageSize, listInput.SkipCount); - return new PagedResultDto(totalCount, ObjectMapper.Map, List>(list)); + var totalCount = await _notificationSubscriptionManager.GetPagingCountAsync(input.NotificationId, input.ReceiverUserId, input.ReceiverUserName, input.StartReadTime, input.EndReadTime); + var list = await _notificationSubscriptionManager.GetPagingListAsync(input.NotificationId, input.ReceiverUserId, input.ReceiverUserName, input.StartReadTime, input.EndReadTime, input.PageSize, input.SkipCount); + var result = new PagedResultDto(totalCount, ObjectMapper.Map, List>(list)); + // 获取消息内容 + if (totalCount > 0) + { + var notifications = await _notificationManager.GetListAsync(list.Select(e => e.NotificationId).Distinct().ToList()); + foreach (var item in result.Items) + { + var notification = notifications.FirstOrDefault(e => e.Id == item.NotificationId); + if (notification != null) + { + item.Title = notification.Title; + item.Content = notification.Content; + item.MessageType = notification.MessageType; + item.MessageLevel = notification.MessageLevel; + item.SenderUserId = notification.SenderUserId; + item.SenderUserName = notification.SenderUserName; + } + } + } + + return result; } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json index e2586de4..207d68d8 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/en.json @@ -9,6 +9,8 @@ "Lion.AbpPro.NotificationManagement:100004": "User UnSubscription", "Lion.AbpPro.NotificationManagement:100005": "Message Title NotNull", "Lion.AbpPro.NotificationManagement:100006": "Message Content NotNull", - "Lion.AbpPro.NotificationManagement:100007": "Message Receiver NotNull" + "Lion.AbpPro.NotificationManagement:100007": "Message Receiver NotNull", + "Permission:NotificationManagement": "NotificationManagement", + "Permission:NotificationSubscriptionManagement": "NotificationSubscriptionManagement" } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json index 809e8755..95321b60 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Localization/NotificationManagement/zh-Hans.json @@ -9,6 +9,8 @@ "Lion.AbpPro.NotificationManagement:100003": "未知的消息类型", "Lion.AbpPro.NotificationManagement:100004": "当前用户未订阅消息", "Lion.AbpPro.NotificationManagement:100005": "消息标题不能为空", - "Lion.AbpPro.NotificationManagement:100006": "消息内容不能为空" + "Lion.AbpPro.NotificationManagement:100006": "消息内容不能为空", + "Permission:NotificationManagement": "消息管理", + "Permission:NotificationSubscriptionManagement": "通告管理" } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs new file mode 100644 index 00000000..d67208cf --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationDto.cs @@ -0,0 +1,69 @@ +using Lion.AbpPro.NotificationManagement.Notifications.Enums; + +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos +{ + public class NotificationDto + { + public Guid Id { get; set; } + + /// + /// 租户id + /// + public Guid? TenantId { get; set; } + + /// + /// 消息标题 + /// + public string Title { get; set; } + + /// + /// 消息内容 + /// + public string Content { get; set; } + + /// + /// 消息类型 + /// + public MessageType MessageType { get; set; } + + /// + /// 消息等级 + /// + public MessageLevel MessageLevel { get; set; } + + /// + /// 发送人 + /// + public Guid SenderUserId { get; set; } + + /// + /// 发送人用户名 + /// + public string SenderUserName { get; set; } + + /// + /// 订阅人 + /// 消息类型是广播消息时,订阅人为空 + /// + public Guid? ReceiveUserId { get; set; } + + + /// + /// 接收人用户名 + /// 消息类型是广播消息时,订接收人用户名为空 + /// + public string ReceiveUserName { get; set; } + + /// + /// 是否已读 + /// + public bool Read { get; set; } + + /// + /// 已读时间 + /// + public DateTime? ReadTime { get; set; } + + public DateTime CreationTime { get; set; } + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationSubscriptionDto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationSubscriptionDto.cs new file mode 100644 index 00000000..c7a949b6 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Dtos/NotificationSubscriptionDto.cs @@ -0,0 +1,36 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications.Dtos; + +public class NotificationSubscriptionDto +{ + public Guid Id { get; set; } + + /// + /// 租户id + /// + public Guid? TenantId { get; private set; } + + /// + /// 消息Id + /// + public Guid NotificationId { get; private set; } + + /// + /// 接收人id + /// + public Guid ReceiveUserId { get; private set; } + + /// + /// 接收人用户名 + /// + public string ReceiveUserName { get; private set; } + + /// + /// 是否已读 + /// + public bool Read { get; private set; } + + /// + /// 已读时间 + /// + public DateTime ReadTime { get; private set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs index 68551910..7bf0283d 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageLevel.cs @@ -10,16 +10,15 @@ public enum MessageLevel /// /// 警告 /// - [Description("警告")] - Warning = 10, + [Description("警告")] Warning = 10, + /// /// 正常 /// - [Description("正常")] - Information = 20, + [Description("正常")] Information = 20, + /// /// 错误 /// - [Description("错误")] - Error = 30, + [Description("错误")] Error = 30, } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs index 983a1e24..0e458e47 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Enums/MessageType.cs @@ -7,17 +7,14 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Enums /// public enum MessageType { - /// /// 广播消息 /// - [Description("广播消息")] - BroadCast = 10, + [Description("广播消息")] BroadCast = 10, + /// /// 普通文本消息 /// - [Description("普通文本消息")] - Common = 20, - + [Description("普通文本消息")] Common = 20, } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs index 11f7b4ce..b44319ae 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/Etos/NotificationEto.cs @@ -7,59 +7,66 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Etos { public class NotificationEto { + public Guid Id { get; set; } + /// /// 租户id /// public Guid? TenantId { get; set; } - - public Guid Id { get; set; } - + /// /// 消息标题 /// - public string Title { get; set; } + public string Title { get; set; } /// /// 消息内容 /// - public string Content { get; set; } + public string Content { get; set; } /// /// 消息类型 /// - public MessageType MessageType { get; set; } + public MessageType MessageType { get; set; } /// /// 消息等级 /// public MessageLevel MessageLevel { get; set; } - + /// /// 发送人 /// - public Guid SenderId { get; set; } + public Guid SenderUserId { get; set; } /// - /// 关联属性1:N 消息订阅者集合 + /// 发送人用户名 /// - public List NotificationSubscriptions { get; set; } - } + public string SenderUserName { get; set; } - public class NotificationSubscriptionEto - { /// /// 订阅人 + /// 消息类型是广播消息时,订阅人为空 /// - public Guid ReceiveId { get; set; } + public Guid? ReceiveUserId { get; set; } + + /// + /// 接收人用户名 + /// 消息类型是广播消息时,订接收人用户名为空 + /// + public string ReceiveUserName { get; set; } + /// /// 是否已读 /// - public bool Read { get; set; } - + public bool Read { get; set; } + /// /// 已读时间 /// - public DateTime? ReadTime { get; set; } + public DateTime? ReadTime { get; set; } } + + } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/MaxLengths/NotificationMaxLengths.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/MaxLengths/NotificationMaxLengths.cs index f20f6266..800c47ce 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/MaxLengths/NotificationMaxLengths.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain.Shared/Notifications/MaxLengths/NotificationMaxLengths.cs @@ -3,14 +3,9 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.MaxLengths public class NotificationMaxLengths { - /// - /// 消息标题 - /// - public const int Title = 256; - /// - /// 消息内容 - /// - public const int Content = 1024; + public const int Length128 = 128; + + public const int Length1024 = 1024; } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs index 3ebcfea0..10c58569 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/NotificationDomainAutoMapperProfile.cs @@ -1,3 +1,5 @@ +using Lion.AbpPro.NotificationManagement.Notifications.Dtos; + namespace Lion.AbpPro.NotificationManagement { public class NotificationDomainAutoMapperProfile:Profile @@ -5,7 +7,8 @@ namespace Lion.AbpPro.NotificationManagement public NotificationDomainAutoMapperProfile() { CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs index 269550f9..016ff770 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/Notification.cs @@ -11,19 +11,15 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates /// 租户id /// public Guid? TenantId { get; private set; } - + /// /// 消息标题 /// - [StringLength(NotificationMaxLengths.Title)] - [Required] public string Title { get; private set; } /// /// 消息内容 /// - [StringLength(NotificationMaxLengths.Content)] - [Required] public string Content { get; private set; } /// @@ -39,16 +35,40 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates /// /// 发送人 /// - public Guid SenderId { get; private set; } + public Guid SenderUserId { get; private set; } + + /// + /// 发送人用户名 + /// + public string SenderUserName { get; private set; } /// - /// 关联属性1:N 消息订阅者集合 + /// 订阅人 + /// 消息类型是广播消息时,订阅人为空 + /// + public Guid? ReceiveUserId { get; private set; } + + + /// + /// 接收人用户名 + /// 消息类型是广播消息时,订接收人用户名为空 + /// + public string ReceiveUserName { get; private set; } + + /// + /// 是否已读 + /// + public bool Read { get; private set; } + + /// + /// 已读时间 /// - public List NotificationSubscriptions { get; private set; } + public DateTime? ReadTime { get; private set; } + private Notification() { - NotificationSubscriptions = new List(); + } public Notification( @@ -57,57 +77,65 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates string content, MessageType messageType, MessageLevel messageLevel, - Guid senderId, + Guid senderUserId, + string senderUserName, + Guid? receiveUserId = null, + string receiveUserName ="", + DateTime? readTime = null, + bool read = false, Guid? tenantId = null ) : base(id) - { - NotificationSubscriptions = new List(); - - SetProperties( - title, - content, - messageType, - messageLevel, - senderId - ); - SetTenantId(tenantId); - } - - private void SetProperties( - string title, - string content, - MessageType messageType, - MessageLevel messageLevel, - Guid senderId - ) { SetTitle(title); SetContent(content); SetMessageType(messageType); SetMessageLevel(messageLevel); - SetSenderId(senderId); + SetSenderUserId(senderUserId); + SetSenderUserName(senderUserName); + SetReceiveUserId(receiveUserId); + SetReceiveUserName(receiveUserName); + SetTenantId(tenantId); + SetRead(read,readTime); } + private void SetTenantId(Guid? tenantId) { TenantId = tenantId; } + + private void SetSenderUserId(Guid senderUserId) + { + Guard.NotEmpty(senderUserId, nameof(senderUserId)); + SenderUserId = senderUserId; + } + + private void SetSenderUserName(string senderUserName) + { + Guard.NotNullOrWhiteSpace(senderUserName, nameof(senderUserName), NotificationMaxLengths.Length128); + SenderUserName = senderUserName; + } + + private void SetReceiveUserId(Guid? receiveUserId) + { + ReceiveUserId = receiveUserId; + } - private void SetSenderId(Guid senderId) + private void SetReceiveUserName(string receiveUserName) { - Guard.NotEmpty(senderId, nameof(senderId)); - SenderId = senderId; + ReceiveUserName = receiveUserName; } + private void SetTitle(string title) { - Guard.NotNullOrWhiteSpace(title, nameof(title), NotificationMaxLengths.Title); + Guard.NotNullOrWhiteSpace(title, nameof(title), NotificationMaxLengths.Length128); Title = title; } private void SetContent(string content) { - Guard.NotNullOrWhiteSpace(content, nameof(content), NotificationMaxLengths.Content); + Guard.NotNullOrWhiteSpace(content, nameof(content), NotificationMaxLengths.Length1024); Content = content; } @@ -120,37 +148,18 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates { MessageLevel = messageLevel; } + - /// - /// 新增非广播消息订阅人 - /// - public void AddNotificationSubscription(Guid notificationSubscriptionId, Guid receiveId) - { - if (NotificationSubscriptions.Any(e => e.ReceiveId == receiveId)) return; - NotificationSubscriptions.Add( - new NotificationSubscription(notificationSubscriptionId, Id, receiveId)); - } - - /// - /// 新增消息类型为广播订阅人 - /// - public void AddBroadCastNotificationSubscription(Guid notificationSubscriptionId, Guid receiveId, DateTime readTime) + public void SetRead(bool read, DateTime? readTime = null) { - if (NotificationSubscriptions.Any(e => e.ReceiveId == receiveId)) - { - return; - } - - var temp = new NotificationSubscription(notificationSubscriptionId, Id, receiveId); - temp.SetRead(readTime); - NotificationSubscriptions.Add(temp); + Read = read; + ReadTime = readTime; } /// /// 添加创建消息事件 /// - public void AddCreatedNotificationLocalEvent( - CreatedNotificationLocalEvent createdNotificationLocalEvent) + public void AddCreatedNotificationLocalEvent(CreatedNotificationLocalEvent createdNotificationLocalEvent) { AddLocalEvent(createdNotificationLocalEvent); } diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs index 1dec78b0..c3ce600a 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/Aggregates/NotificationSubscription.cs @@ -5,22 +5,27 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates /// /// 消息订阅者 /// - public class NotificationSubscription : FullAuditedEntity, IMultiTenant + public class NotificationSubscription : FullAuditedAggregateRoot, IMultiTenant { /// /// 租户id /// public Guid? TenantId { get; private set; } - + /// /// 消息Id /// - public Guid NotificationId { get; set; } - + public Guid NotificationId { get; private set; } + + /// + /// 接收人id + /// + public Guid ReceiveUserId { get; private set; } + /// - /// 订阅人 + /// 接收人用户名 /// - public Guid ReceiveId { get; private set; } + public string ReceiveUserName { get; private set; } /// /// 是否已读 @@ -30,7 +35,7 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates /// /// 已读时间 /// - public DateTime? ReadTime { get; private set; } + public DateTime ReadTime { get; private set; } private NotificationSubscription() @@ -40,31 +45,48 @@ namespace Lion.AbpPro.NotificationManagement.Notifications.Aggregates public NotificationSubscription( Guid id, Guid notificationId, - Guid receiveId, + Guid receiveUserId, + string receiveUserName, + DateTime readTime, + bool read = true, Guid? tenantId = null ) : base(id) { SetNotificationId(notificationId); - SetReceiveId(receiveId); - Read = false; - ReadTime = null; + SetReceiveUserId(receiveUserId); + SetReceiveUserName(receiveUserName); + SetRead(read, readTime); SetTenantId(tenantId); } + public void SetRead(bool read, DateTime readTime) + { + Read = read; + ReadTime = readTime; + } + private void SetTenantId(Guid? tenantId) { TenantId = tenantId; } - + private void SetNotificationId(Guid notificationId) { NotificationId = notificationId; } - private void SetReceiveId(Guid receiveId) + + private void SetReceiveUserId(Guid receiveUserId) { - ReceiveId = receiveId; + ReceiveUserId = receiveUserId; } + private void SetReceiveUserName(string receiveUserName) + { + Guard.NotNullOrWhiteSpace(receiveUserName, nameof(receiveUserName), NotificationMaxLengths.Length128); + ReceiveUserName = receiveUserName; + } + + public void SetRead(DateTime readTime) { Read = true; diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs index 31e2cb00..60c5f44e 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationManager.cs @@ -1,4 +1,5 @@ -using Volo.Abp.DependencyInjection; +using Lion.AbpPro.NotificationManagement.Notifications.Dtos; +using Volo.Abp.DependencyInjection; namespace Lion.AbpPro.NotificationManagement.Notifications; @@ -7,65 +8,60 @@ public interface INotificationManager /// /// 分页获取消息 /// - Task> GetPagingListAsync( - Guid? userId, - MessageType messageType, + Task> GetPagingListAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, int maxResultCount = 10, int skipCount = 0); /// /// 获取消息总条数 /// - Task GetPagingCountAsync(Guid? userId, MessageType messageType); + Task GetPagingCountAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType); /// /// 发送警告文本消息 /// /// 标题 /// 消息内容 - /// 接受人,发送给谁。 - Task SendCommonWarningMessageAsync(string title, string content, List receiveIds); - - /// - /// 发送普通文本消息 - /// - /// 标题 - /// 消息内容 - /// 接受人,发送给谁。 - Task SendCommonInformationMessageAsync(string title, string content, List receiveIds); - - /// - /// 发送错误文本消息 - /// - Task SendCommonErrorMessageAsync(string title, string content, List receiveIds); - + /// 消息等级 + /// 接受人,发送给谁。 + /// 接受人用户名 + Task SendCommonWarningMessageAsync(string title, string content, MessageLevel level, Guid receiveUserId,string receiveUserName); + /// /// 发送警告广播消息 /// /// 标题 /// 消息内容 - Task SendBroadCastWarningMessageAsync(string title, string content); - - /// - /// 发送正常广播消息 - /// - /// 标题 - /// 消息内容 - Task SendBroadCastInformationMessageAsync(string title, string content); - - /// - /// 发送错误广播消息 - /// - /// 标题 - /// 消息内容 - Task SendBroadCastErrorMessageAsync(string title, string content); - + /// 消息等级 + Task SendBroadCastWarningMessageAsync(string title, string content, MessageLevel level); + /// /// 消息设置为已读 /// /// 消息Id Task SetReadAsync(Guid id); - IAbpLazyServiceProvider LazyServiceProvider { get; set; } - IServiceProvider ServiceProvider { get; set; } + Task FindAsync(Guid id); + + Task> GetListAsync(List ids); } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs index a4aff398..5dbf177a 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationRepository.cs @@ -3,20 +3,22 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// /// 消息通知 仓储接口 /// - public partial interface INotificationRepository : IBasicRepository + public interface INotificationRepository : IBasicRepository { - /// - /// 查找用户消息 - /// - /// - Task FindByIdAsync(Guid id); - /// /// 分页获取消息 /// Task> GetPagingListAsync( - Guid? userId, - MessageType messageType, + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default); @@ -24,6 +26,19 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// /// 获取消息总条数 /// - Task GetPagingCountAsync(Guid? userId, MessageType messageType, CancellationToken cancellationToken = default); + Task GetPagingCountAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, + CancellationToken cancellationToken = default); + + Task> GetListAsync(List ids); } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionManager.cs new file mode 100644 index 00000000..5d5215c1 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionManager.cs @@ -0,0 +1,35 @@ +using Lion.AbpPro.NotificationManagement.Notifications.Dtos; + +namespace Lion.AbpPro.NotificationManagement.Notifications; + +public interface INotificationSubscriptionManager +{ + /// + /// 设置已读 + /// + Task SetReadAsync(Guid receiveUserId, string receiveUserName, Guid notificationId); + + /// + /// 分页获取消息 + /// + Task> GetPagingListAsync( + Guid notificationId, + Guid? receiverUserId, + string receiverUserName, + DateTime? startReadTime, + DateTime? endReadTime, + int maxResultCount = 10, + int skipCount = 0, + CancellationToken cancellationToken = default); + + /// + /// 获取消息总条数 + /// + Task GetPagingCountAsync( + Guid notificationId, + Guid? receiverUserId, + string receiverUserName, + DateTime? startReadTime, + DateTime? endReadTime, + CancellationToken cancellationToken = default); +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionRepository.cs new file mode 100644 index 00000000..c3325fdf --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/INotificationSubscriptionRepository.cs @@ -0,0 +1,34 @@ +namespace Lion.AbpPro.NotificationManagement.Notifications +{ + /// + /// 消息通知 仓储接口 + /// + public interface INotificationSubscriptionRepository : IBasicRepository + { + /// + /// 分页获取消息 + /// + Task> GetPagingListAsync( + Guid notificationId, + Guid? receiverUserId, + string receiverUserName, + DateTime? startReadTime, + DateTime? endReadTime, + int maxResultCount = 10, + int skipCount = 0, + CancellationToken cancellationToken = default); + + /// + /// 获取消息总条数 + /// + Task GetPagingCountAsync( + Guid notificationId, + Guid? receiverUserId, + string receiverUserName, + DateTime? startReadTime, + DateTime? endReadTime, + CancellationToken cancellationToken = default); + + Task FindAsync(Guid receiverUserId, Guid notificationId, CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs index e45f6c4a..0d43a1be 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationManager.cs @@ -1,3 +1,4 @@ +using Lion.AbpPro.NotificationManagement.Notifications.Dtos; using Lion.AbpPro.NotificationManagement.Notifications.LocalEvents; namespace Lion.AbpPro.NotificationManagement.Notifications @@ -17,170 +18,82 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// /// 分页获取消息 /// - public async Task> GetPagingListAsync( - Guid? userId, - MessageType messageType, + public async Task> GetPagingListAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, int maxResultCount = 10, int skipCount = 0) { - return await _notificationRepository.GetPagingListAsync(userId, messageType, maxResultCount, skipCount); + var list = await _notificationRepository.GetPagingListAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType, maxResultCount, skipCount); + return ObjectMapper.Map, List>(list); } /// /// 获取消息总条数 /// - public async Task GetPagingCountAsync(Guid? userId, MessageType messageType) + public async Task GetPagingCountAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType) { - return await _notificationRepository.GetPagingCountAsync(userId, messageType); + return await _notificationRepository.GetPagingCountAsync(title, content, senderUserId, senderUserName, receiverUserId, receiverUserName, read, startReadTime, endReadTime, messageType); } - /// - /// 发送警告文本消息 - /// - /// 标题 - /// 消息内容 - /// 接受人,发送给谁。 - public async Task SendCommonWarningMessageAsync(string title, string content, List receiveIds) + public async Task SendCommonWarningMessageAsync(string title, string content, MessageLevel level, Guid receiveUserId, string receiveUserName) { - if (receiveIds is { Count: 0 }) - { - throw new NotificationManagementDomainException(NotificationManagementErrorCodes.ReceiverNotNull); - } - - var senderId = Guid.Empty; - if (_currentUser?.Id != null) + if (!_currentUser.Id.HasValue) { - senderId = _currentUser.Id.Value; + throw new AbpAuthorizationException(); } - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.Common, MessageLevel.Warning, senderId, CurrentTenant.Id); - foreach (var item in receiveIds) - { - entity.AddNotificationSubscription(GuidGenerator.Create(), item); - } - - var notificationEto = ObjectMapper.Map(entity); + var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.Common, level, _currentUser.Id.Value, _currentUser.UserName, receiveUserId, receiveUserName, tenantId: CurrentTenant?.Id); // 发送集成事件 - entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); - await _notificationRepository.InsertAsync(entity); - } - - /// - /// 发送普通文本消息 - /// - /// 标题 - /// 消息内容 - /// 接受人,发送给谁。 - public async Task SendCommonInformationMessageAsync(string title, string content, List receiveIds) - { - if (receiveIds is { Count: 0 }) - { - throw new NotificationManagementDomainException(NotificationManagementErrorCodes.ReceiverNotNull); - } - - var senderId = Guid.Empty; - if (_currentUser?.Id != null) - { - senderId = _currentUser.Id.Value; - } - - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.Common, MessageLevel.Information, senderId, CurrentTenant.Id); - foreach (var item in receiveIds) - { - entity.AddNotificationSubscription(GuidGenerator.Create(), item); - } - var notificationEto = ObjectMapper.Map(entity); - // 发送集成事件 entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); await _notificationRepository.InsertAsync(entity); } - /// - /// 发送错误文本消息 - /// - public async Task SendCommonErrorMessageAsync(string title, string content, List receiveIds) + public async Task SendBroadCastWarningMessageAsync(string title, string content, MessageLevel level) { - if (receiveIds is { Count: 0 }) - { - throw new NotificationManagementDomainException(NotificationManagementErrorCodes.ReceiverNotNull); - } - - var senderId = Guid.Empty; - if (_currentUser?.Id != null) + if (!_currentUser.Id.HasValue) { - senderId = _currentUser.Id.Value; + throw new AbpAuthorizationException(); } - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.Common, MessageLevel.Error, senderId, CurrentTenant.Id); - foreach (var item in receiveIds) - { - entity.AddNotificationSubscription(GuidGenerator.Create(), item); - } - - var notificationEto = ObjectMapper.Map(entity); + var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.BroadCast, level, _currentUser.Id.Value, _currentUser.UserName, tenantId: CurrentTenant?.Id); // 发送集成事件 - entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); - await _notificationRepository.InsertAsync(entity); - } - - /// - /// 发送警告广播消息 - /// - /// 标题 - /// 消息内容 - public async Task SendBroadCastWarningMessageAsync(string title, string content) - { - var senderId = Guid.Empty; - if (_currentUser?.Id != null) - { - senderId = _currentUser.Id.Value; - } - - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.BroadCast, MessageLevel.Warning, senderId, CurrentTenant.Id); var notificationEto = ObjectMapper.Map(entity); - // 发送集成事件 entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); await _notificationRepository.InsertAsync(entity); } - /// - /// 发送正常广播消息 - /// - /// 标题 - /// 消息内容 - public async Task SendBroadCastInformationMessageAsync(string title, string content) - { - var senderId = Guid.Empty; - if (_currentUser?.Id != null) - { - senderId = _currentUser.Id.Value; - } - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.BroadCast, MessageLevel.Information, senderId, CurrentTenant.Id); - var notificationEto = ObjectMapper.Map(entity); - // 发送集成事件 - entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); - await _notificationRepository.InsertAsync(entity); + public async Task FindAsync(Guid id) + { + var notification = await _notificationRepository.FindAsync(id); + if (notification == null) throw new NotificationManagementDomainException(NotificationManagementErrorCodes.MessageNotExist); + return ObjectMapper.Map(notification); } - /// - /// 发送错误广播消息 - /// - /// 标题 - /// 消息内容 - public async Task SendBroadCastErrorMessageAsync(string title, string content) + public async Task> GetListAsync(List ids) { - var senderId = Guid.Empty; - if (_currentUser?.Id != null) - { - senderId = _currentUser.Id.Value; - } - - var entity = new Notification(GuidGenerator.Create(), title, content, MessageType.BroadCast, MessageLevel.Error, senderId, CurrentTenant.Id); - var notificationEto = ObjectMapper.Map(entity); - entity.AddCreatedNotificationLocalEvent(new CreatedNotificationLocalEvent(notificationEto)); - await _notificationRepository.InsertAsync(entity); + var notifications = await _notificationRepository.GetListAsync(ids); + return ObjectMapper.Map, List>(notifications); } /// @@ -191,23 +104,21 @@ namespace Lion.AbpPro.NotificationManagement.Notifications { if (_currentUser is not { IsAuthenticated: true }) throw new AbpAuthorizationException(); - var notification = await _notificationRepository.FindByIdAsync(id); + var notification = await _notificationRepository.FindAsync(id); if (notification == null) throw new NotificationManagementDomainException(NotificationManagementErrorCodes.MessageNotExist); - if (notification.MessageType == MessageType.BroadCast) + if (notification.Read) { - //如果类型是广播消息,用户设置为已读,在插入一条数据 - notification.AddBroadCastNotificationSubscription(GuidGenerator.Create(), _currentUser.GetId(), Clock.Now); return; } - else + + if (notification.MessageType == MessageType.BroadCast) { - var notificationSubscription = notification.NotificationSubscriptions.FirstOrDefault(e => e.ReceiveId == _currentUser.GetId()); - if (notificationSubscription == null) - throw new NotificationManagementDomainException(NotificationManagementErrorCodes.UserUnSubscription); - notificationSubscription.SetRead(Clock.Now); + return; } + notification.SetRead(true, Clock.Now); + await _notificationRepository.UpdateAsync(notification); } } diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationSubscriptionManager.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationSubscriptionManager.cs new file mode 100644 index 00000000..c3b8f163 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.Domain/Notifications/NotificationSubscriptionManager.cs @@ -0,0 +1,36 @@ +using Lion.AbpPro.NotificationManagement.Notifications.Dtos; + +namespace Lion.AbpPro.NotificationManagement.Notifications; + +public class NotificationSubscriptionManager : NotificationManagementDomainService, INotificationSubscriptionManager +{ + private readonly INotificationSubscriptionRepository _notificationSubscriptionRepository; + + public NotificationSubscriptionManager(INotificationSubscriptionRepository notificationSubscriptionRepository) + { + _notificationSubscriptionRepository = notificationSubscriptionRepository; + } + + public async Task SetReadAsync(Guid receiveUserId, string receiveUserName, Guid notificationId) + { + var subscription = await _notificationSubscriptionRepository.FindAsync(receiveUserId, notificationId); + if (subscription != null) + { + return; + } + + subscription = new NotificationSubscription(GuidGenerator.Create(), notificationId, receiveUserId, receiveUserName, Clock.Now, true, CurrentTenant?.Id); + await _notificationSubscriptionRepository.InsertAsync(subscription); + } + + public async Task> GetPagingListAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) + { + var list = await _notificationSubscriptionRepository.GetPagingListAsync(notificationId, receiverUserId, receiverUserName, startReadTime, endReadTime, maxResultCount, skipCount, cancellationToken); + return ObjectMapper.Map, List>(list); + } + + public async Task GetPagingCountAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, CancellationToken cancellationToken = default) + { + return await _notificationSubscriptionRepository.GetPagingCountAsync(notificationId, receiverUserId, receiverUserName, startReadTime, endReadTime, cancellationToken); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/INotificationManagementDbContext.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/INotificationManagementDbContext.cs index a7cc8463..876c809e 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/INotificationManagementDbContext.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/INotificationManagementDbContext.cs @@ -8,5 +8,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore */ DbSet Notifications { get; set; } + + DbSet NotificationSubscriptions { get; set; } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContext.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContext.cs index f22733c8..1d78f28c 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContext.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContext.cs @@ -13,7 +13,8 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore } public DbSet Notifications { get; set; } - + public DbSet NotificationSubscriptions { get; set; } + protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContextModelCreatingExtensions.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContextModelCreatingExtensions.cs index bc64aca8..170f2a21 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/NotificationManagementDbContextModelCreatingExtensions.cs @@ -1,3 +1,5 @@ +using Lion.AbpPro.NotificationManagement.Notifications.MaxLengths; + namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore { public static class NotificationManagementDbContextModelCreatingExtensions @@ -10,13 +12,19 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore builder.Entity(b => { b.ToTable(NotificationManagementDbProperties.DbTablePrefix + "Notifications", NotificationManagementDbProperties.DbSchema); - b.HasMany(e => e.NotificationSubscriptions).WithOne().HasForeignKey(uc => uc.NotificationId).IsRequired(); + b.Property(e => e.Title).IsRequired().HasMaxLength(NotificationMaxLengths.Length128); + b.Property(e => e.Content).IsRequired().HasMaxLength(NotificationMaxLengths.Length1024); + b.Property(e => e.SenderUserName).IsRequired().HasMaxLength(NotificationMaxLengths.Length128); + b.Property(e => e.ReceiveUserName).HasMaxLength(NotificationMaxLengths.Length128); b.ConfigureByConvention(); }); builder.Entity(b => { b.ToTable(NotificationManagementDbProperties.DbTablePrefix + "NotificationSubscriptions", NotificationManagementDbProperties.DbSchema); + b.Property(e => e.ReceiveUserName).HasMaxLength(NotificationMaxLengths.Length128); + b.HasIndex(e => e.NotificationId); + b.HasIndex(e => e.ReceiveUserId); b.ConfigureByConvention(); }); } diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationQueryableExtensions.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationQueryableExtensions.cs deleted file mode 100644 index 427e362e..00000000 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationQueryableExtensions.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications -{ - public static class EfCoreNotificationQueryableExtensions - { - public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) - { - return !include ? queryable : queryable.Include(e => e.NotificationSubscriptions); - } - } -} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs index 07470328..2b625389 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationRepository.cs @@ -3,7 +3,7 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications /// /// 消息通知 仓储Ef core 实现 /// - public partial class EfCoreNotificationRepository : + public class EfCoreNotificationRepository : EfCoreRepository, INotificationRepository { @@ -12,47 +12,67 @@ namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications { } - /// - /// 查找用户消息 - /// - /// - /// - public async Task FindByIdAsync(Guid id) - { - return await (await GetDbSetAsync()) - .IncludeDetails() - .Where(e => e.Id == id) - .FirstOrDefaultAsync(); - } - public async Task> GetPagingListAsync( - Guid? userId, - MessageType messageType, + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) - .IncludeDetails() - .Where(e => e.MessageType == messageType) - .WhereIf(userId.HasValue, e => e.NotificationSubscriptions.Any(s => s.ReceiveId == userId)) + .WhereIf(title.IsNotNullOrWhiteSpace(), e => e.Title.Contains(title)) + .WhereIf(content.IsNotNullOrWhiteSpace(), e => e.Content.Contains(content)) + .WhereIf(senderUserId.HasValue, e => e.SenderUserId == senderUserId.Value) + .WhereIf(senderUserName.IsNotNullOrWhiteSpace(), e => e.SenderUserName == senderUserName) + .WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) + .WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) + .WhereIf(read.HasValue, e => e.Read == read.Value) + .WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) + .WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) + .WhereIf(messageType.HasValue, e => e.MessageType == messageType.Value) .OrderByDescending(e => e.CreationTime) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetPagingCountAsync(Guid? userId, MessageType messageType, CancellationToken cancellationToken = default) + public async Task GetPagingCountAsync( + string title, + string content, + Guid? senderUserId, + string senderUserName, + Guid? receiverUserId, + string receiverUserName, + bool? read, + DateTime? startReadTime, + DateTime? endReadTime, + MessageType? messageType, + CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) - .Where(e => e.MessageType == messageType) - .WhereIf(userId.HasValue, e => e.NotificationSubscriptions.Any(s => s.ReceiveId == userId)) - .CountAsync(cancellationToken: cancellationToken); + .WhereIf(title.IsNotNullOrWhiteSpace(), e => e.Title.Contains(title)) + .WhereIf(content.IsNotNullOrWhiteSpace(), e => e.Content.Contains(content)) + .WhereIf(senderUserId.HasValue, e => e.SenderUserId == senderUserId.Value) + .WhereIf(senderUserName.IsNotNullOrWhiteSpace(), e => e.SenderUserName == senderUserName) + .WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) + .WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) + .WhereIf(read.HasValue, e => e.Read == read.Value) + .WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) + .WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) + .WhereIf(messageType.HasValue, e => e.MessageType == messageType.Value) + .CountAsync(cancellationToken); } - - public override async Task> WithDetailsAsync() + public async Task> GetListAsync(List ids) { - return (await GetQueryableAsync()).IncludeDetails(); + return await (await GetDbSetAsync()).Where(e => ids.Contains(e.Id)).ToListAsync(); } } } \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationSubscriptionRepository.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationSubscriptionRepository.cs new file mode 100644 index 00000000..0b96a570 --- /dev/null +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.EntityFrameworkCore/EntityFrameworkCore/Notifications/EfCoreNotificationSubscriptionRepository.cs @@ -0,0 +1,39 @@ +namespace Lion.AbpPro.NotificationManagement.EntityFrameworkCore.Notifications; + +public class EfCoreNotificationSubscriptionRepository : EfCoreRepository, INotificationSubscriptionRepository +{ + public EfCoreNotificationSubscriptionRepository([NotNull] IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + + public async Task> GetPagingListAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, int maxResultCount = 10, int skipCount = 0, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(e => e.NotificationId == notificationId) + .WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) + .WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) + .WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) + .WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) + .OrderByDescending(e => e.CreationTime) + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async Task GetPagingCountAsync(Guid notificationId, Guid? receiverUserId, string receiverUserName, DateTime? startReadTime, DateTime? endReadTime, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(e => e.NotificationId == notificationId) + .WhereIf(receiverUserId.HasValue, e => e.ReceiveUserId == receiverUserId.Value) + .WhereIf(receiverUserName.IsNotNullOrWhiteSpace(), e => e.ReceiveUserName == receiverUserName) + .WhereIf(startReadTime.HasValue, e => e.ReadTime >= startReadTime.Value) + .WhereIf(endReadTime.HasValue, e => e.ReadTime <= endReadTime.Value) + .OrderByDescending(e => e.CreationTime) + .CountAsync(GetCancellationToken(cancellationToken)); + } + + public async Task FindAsync(Guid receiverUserId, Guid notificationId, CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()).FirstOrDefaultAsync(e => e.ReceiveUserId == receiverUserId && e.NotificationId == notificationId, GetCancellationToken(cancellationToken)); + } +} \ No newline at end of file diff --git a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.HttpApi/Notifications/NotificationController.cs b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.HttpApi/Notifications/NotificationController.cs index be706c22..9ecee9f4 100644 --- a/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.HttpApi/Notifications/NotificationController.cs +++ b/aspnet-core/modules/NotificationManagement/src/Lion.AbpPro.NotificationManagement.HttpApi/Notifications/NotificationController.cs @@ -13,29 +13,26 @@ namespace Lion.AbpPro.NotificationManagement.Notifications /// - /// 分页获取用户普通文本消息 + /// 分页获取文本消息 /// x - [HttpPost("Common")] - [SwaggerOperation(summary: "分页查询普通消息", Tags = new[] { "Notification" })] - public Task> - GetPageCommonNotificationByUserIdAsync( - PagingNotificationListInput listInput) + [HttpPost("NotificationPage")] + [SwaggerOperation(summary: "分页查询消息", Tags = new[] { "Notification" })] + public Task> PageNotificationAsync(PagingNotificationInput input) { - return _notificationAppService.GetPageCommonNotificationByUserIdAsync(listInput); + return _notificationAppService.PageNotificationAsync(input); } /// - /// 分页获取广播消息 - /// - [HttpPost("BroadCast")] - [SwaggerOperation(summary: "分页查询广播消息", Tags = new[] { "Notification" })] - public Task> - GetPageBroadCastNotificationByUserIdAsync( - PagingNotificationListInput listInput) + /// 分页获取广播消息已读人数 + /// x + [HttpPost("NotificationSubscriptionPage")] + [SwaggerOperation(summary: "分页获取广播消息已读人数", Tags = new[] { "Notification" })] + public Task> PageNotificationSubscriptionAsync(PagingNotificationSubscriptionInput input) { - return _notificationAppService.GetPageBroadCastNotificationByUserIdAsync(listInput); + return _notificationAppService.PageNotificationSubscriptionAsync(input); } + [HttpPost("SendCommonWarningMessage")] [SwaggerOperation(summary: "发送警告文本消息", Tags = new[] { "Notification" })] public Task SendCommonWarningMessageAsync(SendCommonMessageInput input) diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json index 51cbb003..ce042f44 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json @@ -34,16 +34,16 @@ "CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100" }, "ConnectionStrings": { - "Default": "Data Source=43.139.143.143;Port=3306;Database=tenantdb;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" + "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" }, "Hangfire": { "Redis": { - "Host": "43.139.143.143:6379,password=1q2w3E*", + "Host": "localhost:6379,password=1q2w3E*", "DB": "2" } }, "Redis": { - "Configuration": "43.139.143.143:6379,password=1q2w3E*,defaultdatabase=5" + "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=5" }, "Jwt": { "Audience": "Lion.AbpPro", diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs index ab74aef0..a80d6db9 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs +++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs @@ -42,6 +42,7 @@ namespace Lion.AbpPro.EntityFrameworkCore public DbSet BackgroundJobs { get; set; } public DbSet AuditLogs { get; set; } public DbSet Notifications { get; set; } + public DbSet NotificationSubscriptions { get; set; } public DbSet DataDictionaries { get; set; } public DbSet Languages { get; set; } public DbSet LanguageTexts { get; set; } diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.Designer.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.Designer.cs deleted file mode 100644 index 05f2a28c..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.Designer.cs +++ /dev/null @@ -1,1991 +0,0 @@ -// -using System; -using Lion.AbpPro.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Volo.Abp.EntityFrameworkCore; - -#nullable disable - -namespace Lion.AbpPro.Migrations -{ - [DbContext(typeof(AbpProDbContext))] - [Migration("20231220041852_Init")] - partial class Init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("DisplayText") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.ToTable("AbpDataDictionaries", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DataDictionaryId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DisplayText") - .HasColumnType("longtext"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Order") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("DataDictionaryId"); - - b.ToTable("AbpDataDictionaryDetails", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.LanguageManagement.LanguageTexts.Aggregates.LanguageText", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("CultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("语言名称"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasComment("名称"); - - b.Property("ResourceName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("资源名称"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasComment("值"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ResourceName", "CultureName"); - - b.ToTable("AbpLanguageTexts", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.LanguageManagement.Languages.Aggregates.Language", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("CultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("语言名称"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("显示名称"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("FlagIcon") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("图标"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("UiCultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("Ui语言名称"); - - b.HasKey("Id"); - - b.HasIndex("CultureName") - .IsUnique(); - - b.ToTable("AbpLanguages", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("MessageLevel") - .HasColumnType("int"); - - b.Property("MessageType") - .HasColumnType("int"); - - b.Property("SenderId") - .HasColumnType("char(36)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.ToTable("AbpNotifications", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("NotificationId") - .HasColumnType("char(36)"); - - b.Property("Read") - .HasColumnType("tinyint(1)"); - - b.Property("ReadTime") - .HasColumnType("datetime(6)"); - - b.Property("ReceiveId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.ToTable("AbpNotificationSubscriptions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApplicationName") - .HasMaxLength(96) - .HasColumnType("varchar(96)") - .HasColumnName("ApplicationName"); - - b.Property("BrowserInfo") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("BrowserInfo"); - - b.Property("ClientId") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ClientId"); - - b.Property("ClientIpAddress") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ClientIpAddress"); - - b.Property("ClientName") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("ClientName"); - - b.Property("Comments") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Comments"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CorrelationId") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("CorrelationId"); - - b.Property("Exceptions") - .HasColumnType("longtext"); - - b.Property("ExecutionDuration") - .HasColumnType("int") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime") - .HasColumnType("datetime(6)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("HttpMethod") - .HasMaxLength(16) - .HasColumnType("varchar(16)") - .HasColumnName("HttpMethod"); - - b.Property("HttpStatusCode") - .HasColumnType("int") - .HasColumnName("HttpStatusCode"); - - b.Property("ImpersonatorTenantId") - .HasColumnType("char(36)") - .HasColumnName("ImpersonatorTenantId"); - - b.Property("ImpersonatorTenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ImpersonatorTenantName"); - - b.Property("ImpersonatorUserId") - .HasColumnType("char(36)") - .HasColumnName("ImpersonatorUserId"); - - b.Property("ImpersonatorUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("ImpersonatorUserName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("TenantName"); - - b.Property("Url") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Url"); - - b.Property("UserId") - .HasColumnType("char(36)") - .HasColumnName("UserId"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("UserName"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AuditLogId") - .HasColumnType("char(36)") - .HasColumnName("AuditLogId"); - - b.Property("ExecutionDuration") - .HasColumnType("int") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime") - .HasColumnType("datetime(6)") - .HasColumnName("ExecutionTime"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("MethodName") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("MethodName"); - - b.Property("Parameters") - .HasMaxLength(2000) - .HasColumnType("varchar(2000)") - .HasColumnName("Parameters"); - - b.Property("ServiceName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("ServiceName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AuditLogId") - .HasColumnType("char(36)") - .HasColumnName("AuditLogId"); - - b.Property("ChangeTime") - .HasColumnType("datetime(6)") - .HasColumnName("ChangeTime"); - - b.Property("ChangeType") - .HasColumnType("tinyint unsigned") - .HasColumnName("ChangeType"); - - b.Property("EntityId") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("EntityId"); - - b.Property("EntityTenantId") - .HasColumnType("char(36)"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("EntityTypeFullName"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("EntityChangeId") - .HasColumnType("char(36)"); - - b.Property("NewValue") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("NewValue"); - - b.Property("OriginalValue") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("OriginalValue"); - - b.Property("PropertyName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("PropertyName"); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("PropertyTypeFullName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("JobName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("LastTryTime") - .HasColumnType("datetime(6)"); - - b.Property("NextTryTime") - .HasColumnType("datetime(6)"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint unsigned") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AllowedProviders") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("DefaultValue") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("GroupName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("IsAvailableToHost") - .HasColumnType("tinyint(1)"); - - b.Property("IsVisibleToClients") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ParentName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ValueType") - .HasMaxLength(2048) - .HasColumnType("varchar(2048)"); - - b.HasKey("Id"); - - b.HasIndex("GroupName"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpFeatures", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpFeatureGroups", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpFeatureValues", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsStatic") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Regex") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("RegexDescription") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Required") - .HasColumnType("tinyint(1)"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("SourceTenantId") - .HasColumnType("char(36)"); - - b.Property("SourceUserId") - .HasColumnType("char(36)"); - - b.Property("TargetTenantId") - .HasColumnType("char(36)"); - - b.Property("TargetUserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") - .IsUnique(); - - b.ToTable("AbpLinkUsers", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)") - .HasColumnName("IsDefault"); - - b.Property("IsPublic") - .HasColumnType("tinyint(1)") - .HasColumnName("IsPublic"); - - b.Property("IsStatic") - .HasColumnType("tinyint(1)") - .HasColumnName("IsStatic"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ClaimValue") - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Action") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("ApplicationName") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("BrowserInfo") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("ClientId") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ClientIpAddress") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CorrelationId") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Identity") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Action"); - - b.HasIndex("TenantId", "ApplicationName"); - - b.HasIndex("TenantId", "Identity"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AbpSecurityLogs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0) - .HasColumnName("AccessFailedCount"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Email"); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("EmailConfirmed"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)") - .HasColumnName("IsActive"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsExternal") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsExternal"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("LastPasswordChangeTime") - .HasColumnType("datetime(6)"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("LockoutEnabled"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("Name"); - - b.Property("NormalizedEmail") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("NormalizedEmail"); - - b.Property("NormalizedUserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("NormalizedUserName"); - - b.Property("PasswordHash") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("PasswordHash"); - - b.Property("PhoneNumber") - .HasMaxLength(16) - .HasColumnType("varchar(16)") - .HasColumnName("PhoneNumber"); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("PhoneNumberConfirmed"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("SecurityStamp"); - - b.Property("ShouldChangePasswordOnNextLogin") - .HasColumnType("tinyint(1)"); - - b.Property("Surname") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("Surname"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("TwoFactorEnabled"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("UserName"); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ClaimValue") - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("datetime(6)"); - - b.Property("SourceUserId") - .HasColumnType("char(36)"); - - b.Property("StartTime") - .HasColumnType("datetime(6)"); - - b.Property("TargetUserId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.ToTable("AbpUserDelegations", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("LoginProvider") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderDisplayName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(196) - .HasColumnType("varchar(196)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("OrganizationUnitId", "UserId"); - - b.HasIndex("UserId", "OrganizationUnitId"); - - b.ToTable("AbpUserOrganizationUnits", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("LoginProvider") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(95) - .HasColumnType("varchar(95)") - .HasColumnName("Code"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("DisplayName"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("ParentId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AbpOrganizationUnits", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("char(36)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("OrganizationUnitId", "RoleId"); - - b.HasIndex("RoleId", "OrganizationUnitId"); - - b.ToTable("AbpOrganizationUnitRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("GroupName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("MultiTenancySide") - .HasColumnType("tinyint unsigned"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ParentName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Providers") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("StateCheckers") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("GroupName"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpPermissions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpPermissionGrants", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpPermissionGroups", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("varchar(2048)"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpSettings", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DefaultValue") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsEncrypted") - .HasColumnType("tinyint(1)"); - - b.Property("IsInherited") - .HasColumnType("tinyint(1)"); - - b.Property("IsVisibleToClients") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Providers") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpSettingDefinitions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Name") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b => - { - b.HasOne("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", null) - .WithMany("Details") - .HasForeignKey("DataDictionaryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null) - .WithMany("NotificationSubscriptions") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("OrganizationUnits") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("ParentId"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany("Roles") - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b => - { - b.Navigation("Details"); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Navigation("NotificationSubscriptions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Navigation("Actions"); - - b.Navigation("EntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Navigation("PropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Navigation("Claims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Navigation("Claims"); - - b.Navigation("Logins"); - - b.Navigation("OrganizationUnits"); - - b.Navigation("Roles"); - - b.Navigation("Tokens"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Navigation("Roles"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Navigation("ConnectionStrings"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.Designer.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.Designer.cs deleted file mode 100644 index d7895f7d..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.Designer.cs +++ /dev/null @@ -1,2003 +0,0 @@ -// -using System; -using Lion.AbpPro.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Volo.Abp.EntityFrameworkCore; - -#nullable disable - -namespace Lion.AbpPro.Migrations -{ - [DbContext(typeof(AbpProDbContext))] - [Migration("20240404001711_AddTenantId")] - partial class AddTenantId - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("DisplayText") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.ToTable("AbpDataDictionaries", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .HasColumnType("longtext"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DataDictionaryId") - .HasColumnType("char(36)"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("DisplayText") - .HasColumnType("longtext"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Order") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("DataDictionaryId"); - - b.ToTable("AbpDataDictionaryDetails", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.LanguageManagement.LanguageTexts.Aggregates.LanguageText", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("CultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("语言名称"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasComment("名称"); - - b.Property("ResourceName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("资源名称"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasComment("值"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ResourceName", "CultureName"); - - b.ToTable("AbpLanguageTexts", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.LanguageManagement.Languages.Aggregates.Language", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("CultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("语言名称"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("显示名称"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("FlagIcon") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("图标"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UiCultureName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasComment("Ui语言名称"); - - b.HasKey("Id"); - - b.HasIndex("CultureName") - .IsUnique(); - - b.ToTable("AbpLanguages", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Content") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("MessageLevel") - .HasColumnType("int"); - - b.Property("MessageType") - .HasColumnType("int"); - - b.Property("SenderId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.ToTable("AbpNotifications", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("NotificationId") - .HasColumnType("char(36)"); - - b.Property("Read") - .HasColumnType("tinyint(1)"); - - b.Property("ReadTime") - .HasColumnType("datetime(6)"); - - b.Property("ReceiveId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("NotificationId"); - - b.ToTable("AbpNotificationSubscriptions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ApplicationName") - .HasMaxLength(96) - .HasColumnType("varchar(96)") - .HasColumnName("ApplicationName"); - - b.Property("BrowserInfo") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("BrowserInfo"); - - b.Property("ClientId") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ClientId"); - - b.Property("ClientIpAddress") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ClientIpAddress"); - - b.Property("ClientName") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("ClientName"); - - b.Property("Comments") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Comments"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CorrelationId") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("CorrelationId"); - - b.Property("Exceptions") - .HasColumnType("longtext"); - - b.Property("ExecutionDuration") - .HasColumnType("int") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime") - .HasColumnType("datetime(6)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("HttpMethod") - .HasMaxLength(16) - .HasColumnType("varchar(16)") - .HasColumnName("HttpMethod"); - - b.Property("HttpStatusCode") - .HasColumnType("int") - .HasColumnName("HttpStatusCode"); - - b.Property("ImpersonatorTenantId") - .HasColumnType("char(36)") - .HasColumnName("ImpersonatorTenantId"); - - b.Property("ImpersonatorTenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("ImpersonatorTenantName"); - - b.Property("ImpersonatorUserId") - .HasColumnType("char(36)") - .HasColumnName("ImpersonatorUserId"); - - b.Property("ImpersonatorUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("ImpersonatorUserName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("TenantName"); - - b.Property("Url") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Url"); - - b.Property("UserId") - .HasColumnType("char(36)") - .HasColumnName("UserId"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("UserName"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AuditLogId") - .HasColumnType("char(36)") - .HasColumnName("AuditLogId"); - - b.Property("ExecutionDuration") - .HasColumnType("int") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime") - .HasColumnType("datetime(6)") - .HasColumnName("ExecutionTime"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("MethodName") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("MethodName"); - - b.Property("Parameters") - .HasMaxLength(2000) - .HasColumnType("varchar(2000)") - .HasColumnName("Parameters"); - - b.Property("ServiceName") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("ServiceName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AuditLogId") - .HasColumnType("char(36)") - .HasColumnName("AuditLogId"); - - b.Property("ChangeTime") - .HasColumnType("datetime(6)") - .HasColumnName("ChangeTime"); - - b.Property("ChangeType") - .HasColumnType("tinyint unsigned") - .HasColumnName("ChangeType"); - - b.Property("EntityId") - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("EntityId"); - - b.Property("EntityTenantId") - .HasColumnType("char(36)"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("EntityTypeFullName"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("EntityChangeId") - .HasColumnType("char(36)"); - - b.Property("NewValue") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("NewValue"); - - b.Property("OriginalValue") - .HasMaxLength(512) - .HasColumnType("varchar(512)") - .HasColumnName("OriginalValue"); - - b.Property("PropertyName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("PropertyName"); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("PropertyTypeFullName"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasMaxLength(1048576) - .HasColumnType("longtext"); - - b.Property("JobName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("LastTryTime") - .HasColumnType("datetime(6)"); - - b.Property("NextTryTime") - .HasColumnType("datetime(6)"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint unsigned") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AllowedProviders") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("DefaultValue") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("GroupName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("IsAvailableToHost") - .HasColumnType("tinyint(1)"); - - b.Property("IsVisibleToClients") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ParentName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ValueType") - .HasMaxLength(2048) - .HasColumnType("varchar(2048)"); - - b.HasKey("Id"); - - b.HasIndex("GroupName"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpFeatures", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpFeatureGroups", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpFeatureValues", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("Description") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsStatic") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("Regex") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("RegexDescription") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Required") - .HasColumnType("tinyint(1)"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("SourceTenantId") - .HasColumnType("char(36)"); - - b.Property("SourceUserId") - .HasColumnType("char(36)"); - - b.Property("TargetTenantId") - .HasColumnType("char(36)"); - - b.Property("TargetUserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") - .IsUnique(); - - b.ToTable("AbpLinkUsers", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)") - .HasColumnName("IsDefault"); - - b.Property("IsPublic") - .HasColumnType("tinyint(1)") - .HasColumnName("IsPublic"); - - b.Property("IsStatic") - .HasColumnType("tinyint(1)") - .HasColumnName("IsStatic"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ClaimValue") - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Action") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("ApplicationName") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("BrowserInfo") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("ClientId") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ClientIpAddress") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CorrelationId") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Identity") - .HasMaxLength(96) - .HasColumnType("varchar(96)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TenantName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Action"); - - b.HasIndex("TenantId", "ApplicationName"); - - b.HasIndex("TenantId", "Identity"); - - b.HasIndex("TenantId", "UserId"); - - b.ToTable("AbpSecurityLogs", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0) - .HasColumnName("AccessFailedCount"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("Email"); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("EmailConfirmed"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsActive") - .HasColumnType("tinyint(1)") - .HasColumnName("IsActive"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("IsExternal") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsExternal"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("LastPasswordChangeTime") - .HasColumnType("datetime(6)"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("LockoutEnabled"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("Name") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("Name"); - - b.Property("NormalizedEmail") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("NormalizedEmail"); - - b.Property("NormalizedUserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("NormalizedUserName"); - - b.Property("PasswordHash") - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("PasswordHash"); - - b.Property("PhoneNumber") - .HasMaxLength(16) - .HasColumnType("varchar(16)") - .HasColumnName("PhoneNumber"); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("PhoneNumberConfirmed"); - - b.Property("SecurityStamp") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("SecurityStamp"); - - b.Property("ShouldChangePasswordOnNextLogin") - .HasColumnType("tinyint(1)"); - - b.Property("Surname") - .HasMaxLength(64) - .HasColumnType("varchar(64)") - .HasColumnName("Surname"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("TwoFactorEnabled"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)") - .HasColumnName("UserName"); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ClaimValue") - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("EndTime") - .HasColumnType("datetime(6)"); - - b.Property("SourceUserId") - .HasColumnType("char(36)"); - - b.Property("StartTime") - .HasColumnType("datetime(6)"); - - b.Property("TargetUserId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.ToTable("AbpUserDelegations", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("LoginProvider") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderDisplayName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(196) - .HasColumnType("varchar(196)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("OrganizationUnitId", "UserId"); - - b.HasIndex("UserId", "OrganizationUnitId"); - - b.ToTable("AbpUserOrganizationUnits", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("LoginProvider") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(95) - .HasColumnType("varchar(95)") - .HasColumnName("Code"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)") - .HasColumnName("DisplayName"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("ParentId") - .HasColumnType("char(36)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("ParentId"); - - b.ToTable("AbpOrganizationUnits", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.Property("OrganizationUnitId") - .HasColumnType("char(36)"); - - b.Property("RoleId") - .HasColumnType("char(36)"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("OrganizationUnitId", "RoleId"); - - b.HasIndex("RoleId", "OrganizationUnitId"); - - b.ToTable("AbpOrganizationUnitRoles", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("GroupName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("MultiTenancySide") - .HasColumnType("tinyint unsigned"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ParentName") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Providers") - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("StateCheckers") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("GroupName"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpPermissions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("TenantId") - .HasColumnType("char(36)") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpPermissionGrants", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpPermissionGroups", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("ProviderKey") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("ProviderName") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("varchar(2048)"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey") - .IsUnique(); - - b.ToTable("AbpSettings", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("DefaultValue") - .HasMaxLength(2048) - .HasColumnType("varchar(2048)"); - - b.Property("Description") - .HasMaxLength(512) - .HasColumnType("varchar(512)"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("ExtraProperties") - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsEncrypted") - .HasColumnType("tinyint(1)"); - - b.Property("IsInherited") - .HasColumnType("tinyint(1)"); - - b.Property("IsVisibleToClients") - .HasColumnType("tinyint(1)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("varchar(128)"); - - b.Property("Providers") - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpSettingDefinitions", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .HasColumnType("char(36)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(40) - .HasColumnType("varchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime(6)") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("char(36)") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("char(36)") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime(6)") - .HasColumnName("DeletionTime"); - - b.Property("EntityVersion") - .HasColumnType("int"); - - b.Property("ExtraProperties") - .IsRequired() - .HasColumnType("longtext") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint(1)") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime(6)") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("char(36)") - .HasColumnName("LastModifierId"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants", (string)null); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Name") - .HasMaxLength(64) - .HasColumnType("varchar(64)"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(1024) - .HasColumnType("varchar(1024)"); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings", (string)null); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b => - { - b.HasOne("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", null) - .WithMany("Details") - .HasForeignKey("DataDictionaryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null) - .WithMany("NotificationSubscriptions") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("OrganizationUnits") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany() - .HasForeignKey("ParentId"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => - { - b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) - .WithMany("Roles") - .HasForeignKey("OrganizationUnitId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b => - { - b.Navigation("Details"); - }); - - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Navigation("NotificationSubscriptions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Navigation("Actions"); - - b.Navigation("EntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Navigation("PropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Navigation("Claims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Navigation("Claims"); - - b.Navigation("Logins"); - - b.Navigation("OrganizationUnits"); - - b.Navigation("Roles"); - - b.Navigation("Tokens"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => - { - b.Navigation("Roles"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Navigation("ConnectionStrings"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.cs deleted file mode 100644 index 336b16a3..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404001711_AddTenantId.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Lion.AbpPro.Migrations -{ - /// - public partial class AddTenantId : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Providers", - table: "AbpSettingDefinitions", - type: "varchar(1024)", - maxLength: 1024, - nullable: true, - oldClrType: typeof(string), - oldType: "varchar(128)", - oldMaxLength: 128, - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "DefaultValue", - table: "AbpSettingDefinitions", - type: "varchar(2048)", - maxLength: 2048, - nullable: true, - oldClrType: typeof(string), - oldType: "varchar(256)", - oldMaxLength: 256, - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "TenantId", - table: "AbpNotificationSubscriptions", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - - migrationBuilder.AddColumn( - name: "TenantId", - table: "AbpNotifications", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - - migrationBuilder.AddColumn( - name: "TenantId", - table: "AbpLanguages", - type: "char(36)", - nullable: true, - collation: "ascii_general_ci"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "TenantId", - table: "AbpNotificationSubscriptions"); - - migrationBuilder.DropColumn( - name: "TenantId", - table: "AbpNotifications"); - - migrationBuilder.DropColumn( - name: "TenantId", - table: "AbpLanguages"); - - migrationBuilder.AlterColumn( - name: "Providers", - table: "AbpSettingDefinitions", - type: "varchar(128)", - maxLength: 128, - nullable: true, - oldClrType: typeof(string), - oldType: "varchar(1024)", - oldMaxLength: 1024, - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AlterColumn( - name: "DefaultValue", - table: "AbpSettingDefinitions", - type: "varchar(256)", - maxLength: 256, - nullable: true, - oldClrType: typeof(string), - oldType: "varchar(2048)", - oldMaxLength: 2048, - oldNullable: true) - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:CharSet", "utf8mb4"); - } - } -} diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.cs deleted file mode 100644 index fdcfee21..00000000 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Lion.AbpPro.Migrations -{ - /// - public partial class RemoveLanguageIndex : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AbpLanguages_CultureName", - table: "AbpLanguages"); - - migrationBuilder.CreateIndex( - name: "IX_AbpLanguages_CultureName", - table: "AbpLanguages", - column: "CultureName"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AbpLanguages_CultureName", - table: "AbpLanguages"); - - migrationBuilder.CreateIndex( - name: "IX_AbpLanguages_CultureName", - table: "AbpLanguages", - column: "CultureName", - unique: true); - } - } -} diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.Designer.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.Designer.cs similarity index 97% rename from aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.Designer.cs rename to aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.Designer.cs index 8f7f9fd2..8eab25d7 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240404004344_RemoveLanguageIndex.Designer.cs +++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.Designer.cs @@ -12,8 +12,8 @@ using Volo.Abp.EntityFrameworkCore; namespace Lion.AbpPro.Migrations { [DbContext(typeof(AbpProDbContext))] - [Migration("20240404004344_RemoveLanguageIndex")] - partial class RemoveLanguageIndex + [Migration("20240418052548_1.0.0")] + partial class _100 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -368,17 +368,35 @@ namespace Lion.AbpPro.Migrations b.Property("MessageType") .HasColumnType("int"); - b.Property("SenderId") + b.Property("Read") + .HasColumnType("tinyint(1)"); + + b.Property("ReadTime") + .HasColumnType("datetime(6)"); + + b.Property("ReceiveUserId") .HasColumnType("char(36)"); + b.Property("ReceiveUserName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("SenderUserId") + .HasColumnType("char(36)"); + + b.Property("SenderUserName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("TenantId") .HasColumnType("char(36)") .HasColumnName("TenantId"); b.Property("Title") .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); + .HasMaxLength(128) + .HasColumnType("varchar(128)"); b.HasKey("Id"); @@ -390,6 +408,13 @@ namespace Lion.AbpPro.Migrations b.Property("Id") .HasColumnType("char(36)"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationTime") .HasColumnType("datetime(6)") .HasColumnName("CreationTime"); @@ -406,6 +431,11 @@ namespace Lion.AbpPro.Migrations .HasColumnType("datetime(6)") .HasColumnName("DeletionTime"); + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("tinyint(1)") @@ -426,12 +456,16 @@ namespace Lion.AbpPro.Migrations b.Property("Read") .HasColumnType("tinyint(1)"); - b.Property("ReadTime") + b.Property("ReadTime") .HasColumnType("datetime(6)"); - b.Property("ReceiveId") + b.Property("ReceiveUserId") .HasColumnType("char(36)"); + b.Property("ReceiveUserName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("TenantId") .HasColumnType("char(36)") .HasColumnName("TenantId"); @@ -440,6 +474,8 @@ namespace Lion.AbpPro.Migrations b.HasIndex("NotificationId"); + b.HasIndex("ReceiveUserId"); + b.ToTable("AbpNotificationSubscriptions", (string)null); }); @@ -1814,15 +1850,6 @@ namespace Lion.AbpPro.Migrations .IsRequired(); }); - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null) - .WithMany("NotificationSubscriptions") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) @@ -1952,11 +1979,6 @@ namespace Lion.AbpPro.Migrations b.Navigation("Details"); }); - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Navigation("NotificationSubscriptions"); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Navigation("Actions"); diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.cs similarity index 97% rename from aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.cs rename to aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.cs index 00ebd5c7..0f22e042 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20231220041852_Init.cs +++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20240418052548_1.0.0.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace Lion.AbpPro.Migrations { /// - public partial class Init : Migration + public partial class _100 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -223,6 +223,7 @@ namespace Lion.AbpPro.Migrations columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), CultureName = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "语言名称") .Annotation("MySql:CharSet", "utf8mb4"), UiCultureName = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "Ui语言名称") @@ -304,13 +305,21 @@ namespace Lion.AbpPro.Migrations columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Title = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) + TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + Title = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Content = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), MessageType = table.Column(type: "int", nullable: false), MessageLevel = table.Column(type: "int", nullable: false), - SenderId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + SenderUserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + SenderUserName = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ReceiveUserId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + ReceiveUserName = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Read = table.Column(type: "tinyint(1)", nullable: false), + ReadTime = table.Column(type: "datetime(6)", nullable: true), ExtraProperties = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) @@ -329,6 +338,36 @@ namespace Lion.AbpPro.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "AbpNotificationSubscriptions", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + NotificationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ReceiveUserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ReceiveUserName = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Read = table.Column(type: "tinyint(1)", nullable: false), + ReadTime = table.Column(type: "datetime(6)", nullable: false), + ExtraProperties = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + DeletionTime = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpNotificationSubscriptions", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "AbpOrganizationUnits", columns: table => new @@ -502,10 +541,10 @@ namespace Lion.AbpPro.Migrations .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(512)", maxLength: 512, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), - DefaultValue = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + DefaultValue = table.Column(type: "varchar(2048)", maxLength: 2048, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsVisibleToClients = table.Column(type: "tinyint(1)", nullable: false), - Providers = table.Column(type: "varchar(128)", maxLength: 128, nullable: true) + Providers = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsInherited = table.Column(type: "tinyint(1)", nullable: false), IsEncrypted = table.Column(type: "tinyint(1)", nullable: false), @@ -724,35 +763,6 @@ namespace Lion.AbpPro.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); - migrationBuilder.CreateTable( - name: "AbpNotificationSubscriptions", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - NotificationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - ReceiveId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Read = table.Column(type: "tinyint(1)", nullable: false), - ReadTime = table.Column(type: "datetime(6)", nullable: true), - CreationTime = table.Column(type: "datetime(6)", nullable: false), - CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - LastModificationTime = table.Column(type: "datetime(6)", nullable: true), - LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), - DeletionTime = table.Column(type: "datetime(6)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpNotificationSubscriptions", x => x.Id); - table.ForeignKey( - name: "FK_AbpNotificationSubscriptions_AbpNotifications_NotificationId", - column: x => x.NotificationId, - principalTable: "AbpNotifications", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - migrationBuilder.CreateTable( name: "AbpOrganizationUnitRoles", columns: table => new @@ -1054,8 +1064,7 @@ namespace Lion.AbpPro.Migrations migrationBuilder.CreateIndex( name: "IX_AbpLanguages_CultureName", table: "AbpLanguages", - column: "CultureName", - unique: true); + column: "CultureName"); migrationBuilder.CreateIndex( name: "IX_AbpLanguageTexts_TenantId_ResourceName_CultureName", @@ -1073,6 +1082,11 @@ namespace Lion.AbpPro.Migrations table: "AbpNotificationSubscriptions", column: "NotificationId"); + migrationBuilder.CreateIndex( + name: "IX_AbpNotificationSubscriptions_ReceiveUserId", + table: "AbpNotificationSubscriptions", + column: "ReceiveUserId"); + migrationBuilder.CreateIndex( name: "IX_AbpOrganizationUnitRoles_RoleId_OrganizationUnitId", table: "AbpOrganizationUnitRoles", @@ -1235,6 +1249,9 @@ namespace Lion.AbpPro.Migrations migrationBuilder.DropTable( name: "AbpLinkUsers"); + migrationBuilder.DropTable( + name: "AbpNotifications"); + migrationBuilder.DropTable( name: "AbpNotificationSubscriptions"); @@ -1289,9 +1306,6 @@ namespace Lion.AbpPro.Migrations migrationBuilder.DropTable( name: "AbpEntityChanges"); - migrationBuilder.DropTable( - name: "AbpNotifications"); - migrationBuilder.DropTable( name: "AbpTenants"); diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs index 55f8aaa3..b73563a1 100644 --- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs +++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs @@ -365,17 +365,35 @@ namespace Lion.AbpPro.Migrations b.Property("MessageType") .HasColumnType("int"); - b.Property("SenderId") + b.Property("Read") + .HasColumnType("tinyint(1)"); + + b.Property("ReadTime") + .HasColumnType("datetime(6)"); + + b.Property("ReceiveUserId") .HasColumnType("char(36)"); + b.Property("ReceiveUserName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("SenderUserId") + .HasColumnType("char(36)"); + + b.Property("SenderUserName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("TenantId") .HasColumnType("char(36)") .HasColumnName("TenantId"); b.Property("Title") .IsRequired() - .HasMaxLength(256) - .HasColumnType("varchar(256)"); + .HasMaxLength(128) + .HasColumnType("varchar(128)"); b.HasKey("Id"); @@ -387,6 +405,13 @@ namespace Lion.AbpPro.Migrations b.Property("Id") .HasColumnType("char(36)"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationTime") .HasColumnType("datetime(6)") .HasColumnName("CreationTime"); @@ -403,6 +428,11 @@ namespace Lion.AbpPro.Migrations .HasColumnType("datetime(6)") .HasColumnName("DeletionTime"); + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("tinyint(1)") @@ -423,12 +453,16 @@ namespace Lion.AbpPro.Migrations b.Property("Read") .HasColumnType("tinyint(1)"); - b.Property("ReadTime") + b.Property("ReadTime") .HasColumnType("datetime(6)"); - b.Property("ReceiveId") + b.Property("ReceiveUserId") .HasColumnType("char(36)"); + b.Property("ReceiveUserName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + b.Property("TenantId") .HasColumnType("char(36)") .HasColumnName("TenantId"); @@ -437,6 +471,8 @@ namespace Lion.AbpPro.Migrations b.HasIndex("NotificationId"); + b.HasIndex("ReceiveUserId"); + b.ToTable("AbpNotificationSubscriptions", (string)null); }); @@ -1811,15 +1847,6 @@ namespace Lion.AbpPro.Migrations .IsRequired(); }); - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b => - { - b.HasOne("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", null) - .WithMany("NotificationSubscriptions") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) @@ -1949,11 +1976,6 @@ namespace Lion.AbpPro.Migrations b.Navigation("Details"); }); - modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b => - { - b.Navigation("NotificationSubscriptions"); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Navigation("Actions"); diff --git a/vben28/src/hooks/web/useSignalR.ts b/vben28/src/hooks/web/useSignalR.ts index 93989751..e884e18e 100644 --- a/vben28/src/hooks/web/useSignalR.ts +++ b/vben28/src/hooks/web/useSignalR.ts @@ -72,21 +72,16 @@ export function useSignalR() { message: message.title, description: message.content, }); - } else if (message.messageLevel == 20) { + } if (message.messageLevel == 20) { notification.info({ message: message.title, description: message.content, }); - } else if (message.messageLevel == 30) { + } if (message.messageLevel == 30) { notification.error({ message: message.title, description: message.content, }); - } else { - notification.info({ - message: message.title, - description: message.content, - }); } } @@ -101,21 +96,16 @@ export function useSignalR() { message: message.title, description: message.content, }); - } else if (message.messageLevel == 20) { + } if (message.messageLevel == 20) { notification.info({ message: message.title, description: message.content, }); - } else if (message.messageLevel == 30) { + } if (message.messageLevel == 30) { notification.error({ message: message.title, description: message.content, }); - } else { - notification.info({ - message: message.title, - description: message.content, - }); } } diff --git a/vben28/src/layouts/default/header/components/notify/NoticeList.vue b/vben28/src/layouts/default/header/components/notify/NoticeList.vue index f3689abd..d5dd6383 100644 --- a/vben28/src/layouts/default/header/components/notify/NoticeList.vue +++ b/vben28/src/layouts/default/header/components/notify/NoticeList.vue @@ -5,33 +5,28 @@ @@ -41,95 +36,110 @@ diff --git a/vben28/src/layouts/default/header/components/notify/data.ts b/vben28/src/layouts/default/header/components/notify/data.ts index e1a3ed2d..70c804ff 100644 --- a/vben28/src/layouts/default/header/components/notify/data.ts +++ b/vben28/src/layouts/default/header/components/notify/data.ts @@ -1,9 +1,12 @@ import { NotificationServiceProxy, - PagingNotificationListOutput, - PagingNotificationListInput, - PagingNotificationListOutputPagedResultDto, + PagingNotificationOutput, + PagingNotificationInput, + PagingNotificationSubscriptionInput, + PagingNotificationOutputPagedResultDto, } from '/@/services/ServiceProxies'; +import { useUserStoreWithOut } from '/@/store/modules/user'; +const userStore = useUserStoreWithOut(); export interface ListItem { id: string; avatar: string; @@ -23,7 +26,7 @@ export interface ListItem { export interface TabItem { key: string; name: string; - list?: PagingNotificationListOutput[]; + list?: PagingNotificationOutput[]; unreadlist?: ListItem[]; } @@ -40,21 +43,27 @@ export const tabListData: TabItem[] = [ }, ]; -export async function getTextAsync(): Promise { - let request = new PagingNotificationListInput(); +export async function getTextAsync(): Promise { + let request = new PagingNotificationInput(); request.pageSize = 5; + request.pageIndex = 1; + request.receiverUserId = userStore.getUserInfo.userId as string; + request.messageType = 20; const _notificationServiceProxy = new NotificationServiceProxy(); - return await _notificationServiceProxy.common(request); + return await _notificationServiceProxy.notificationPage(request); } -export async function getBroadCastAsync(): Promise { - let request = new PagingNotificationListInput(); +export async function getBroadCastAsync(): Promise { + let request = new PagingNotificationInput(); request.pageSize = 5; + request.pageIndex = 1; + request.messageType = 10; const _notificationServiceProxy = new NotificationServiceProxy(); - return await _notificationServiceProxy.broadCast(request); + return await _notificationServiceProxy.notificationPage(request); } export async function setReadAsync(request) { const _notificationServiceProxy = new NotificationServiceProxy(); await _notificationServiceProxy.read(request); } + diff --git a/vben28/src/layouts/default/header/components/notify/index.vue b/vben28/src/layouts/default/header/components/notify/index.vue index ce968efb..1c7a32c6 100644 --- a/vben28/src/layouts/default/header/components/notify/index.vue +++ b/vben28/src/layouts/default/header/components/notify/index.vue @@ -25,7 +25,7 @@ import { defineComponent, computed } from 'vue'; import { Popover, Tabs, Badge } from 'ant-design-vue'; import { BellOutlined } from '@ant-design/icons-vue'; - import { PagingNotificationListOutput } from '/@/services/ServiceProxies'; + import { PagingNotificationOutput } from '/@/services/ServiceProxies'; import { tabListData } from './data'; import NoticeList from './NoticeList.vue'; import { useDesign } from '/@/hooks/web/useDesign'; @@ -34,8 +34,8 @@ export default defineComponent({ components: { Popover, BellOutlined, Tabs, TabPane: Tabs.TabPane, Badge, NoticeList }, props: { - textMessage: Array as PropType, - broadCastMessage: Array as PropType, + textMessage: Array as PropType, + broadCastMessage: Array as PropType, ff: string, }, setup(props) { diff --git a/vben28/src/layouts/default/header/index.vue b/vben28/src/layouts/default/header/index.vue index 59e1537b..203c0112 100644 --- a/vben28/src/layouts/default/header/index.vue +++ b/vben28/src/layouts/default/header/index.vue @@ -84,7 +84,7 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; import { useLocale } from '/@/locales/useLocale'; import { useSignalR } from '/@/hooks/web/useSignalR'; - import { PagingNotificationListOutput } from '/@/services/ServiceProxies'; + import { PagingNotificationOutput } from '/@/services/ServiceProxies'; import { getTextAsync, getBroadCastAsync, @@ -181,8 +181,8 @@ onMounted(() => { startConnect(); }); - let textMessage: PagingNotificationListOutput[] = []; - let broadCastMessage: PagingNotificationListOutput[] = []; + let textMessage: PagingNotificationOutput[] = []; + let broadCastMessage: PagingNotificationOutput[] = []; const notifiData = reactive({ textMessage, broadCastMessage, @@ -190,10 +190,10 @@ const clickNotify = async () => { notifiData.textMessage = (await ( await getTextAsync() - ).items) as PagingNotificationListOutput[]; + ).items) as PagingNotificationOutput[]; notifiData.broadCastMessage = (await ( await getBroadCastAsync() - ).items) as PagingNotificationListOutput[]; + ).items) as PagingNotificationOutput[]; console.log(notifiData); }; return { diff --git a/vben28/src/locales/lang/en/routes/admin.ts b/vben28/src/locales/lang/en/routes/admin.ts index e56025a8..1d2b377b 100644 --- a/vben28/src/locales/lang/en/routes/admin.ts +++ b/vben28/src/locales/lang/en/routes/admin.ts @@ -97,4 +97,17 @@ export default { identitySecurityLog_CorrelationId: 'CorrelationId', identitySecurityLog_ClientIpAddress: 'ClientIpAddress', identitySecurityLog_CreationTime: 'LoginTime', + notificationManagement: 'NotificationManagement', + notificationSubscriptionManagement: 'NotificationSubscriptionManagement', + notificationManagement_title : 'Title', + notificationManagement_content : 'Content', + notificationManagement_read : 'Read', + notificationManagement_readTime : 'ReadTime', + notificationManagement_messageType : 'Type', + notificationManagement_messageLevel : 'Level', + notificationManagement_senderUserName : 'SenderUserName ', + notificationManagement_receiveUserName : 'ReceiveUserName', + notificationManagement_setRead : 'SetRead', + notificationManagement_sendNotification : 'SendNotification', + notificationManagement_sendNotificationSubscription : 'SendNotificationSubscription', }; diff --git a/vben28/src/locales/lang/zh-CN/routes/admin.ts b/vben28/src/locales/lang/zh-CN/routes/admin.ts index 1bbb4064..b891cfeb 100644 --- a/vben28/src/locales/lang/zh-CN/routes/admin.ts +++ b/vben28/src/locales/lang/zh-CN/routes/admin.ts @@ -97,4 +97,17 @@ export default { identitySecurityLog_CorrelationId: 'CorrelationId', identitySecurityLog_ClientIpAddress: '客户端IP', identitySecurityLog_CreationTime: '登录时间', + notificationManagement: '消息管理', + notificationSubscriptionManagement: '通告管理', + notificationManagement_title : '标题', + notificationManagement_content : '内容', + notificationManagement_read : '已读', + notificationManagement_readTime : '已读时间', + notificationManagement_messageType : '类型', + notificationManagement_messageLevel : '级别', + notificationManagement_senderUserName : '发送人', + notificationManagement_receiveUserName : '接收人', + notificationManagement_setRead : '设置已读', + notificationManagement_sendNotification : '发送消息', + notificationManagement_sendNotificationSubscription : '发送公告', }; diff --git a/vben28/src/router/routes/modules/admin.ts b/vben28/src/router/routes/modules/admin.ts index aa925013..f38cc055 100644 --- a/vben28/src/router/routes/modules/admin.ts +++ b/vben28/src/router/routes/modules/admin.ts @@ -114,6 +114,26 @@ const admin: AppRouteModule = { policy: 'AbpIdentity.LanguageTexts', }, }, + { + path: 'notification', + name: 'notification', + component: () => import('/@/views/admin/notification/Index.vue'), + meta: { + title: t('routes.admin.notificationManagement'), + icon: 'ant-design:comment-outlined', + policy: 'AbpIdentity.NotificationManagement', + }, + }, + { + path: 'subscription', + name: 'subscription', + component: () => import('/@/views/admin/notification/Subscription.vue'), + meta: { + title: t('routes.admin.notificationSubscriptionManagement'), + icon: 'ant-design:customer-service-twotone', + policy: 'AbpIdentity.NotificationSubscriptionManagement', + }, + }, ], }; diff --git a/vben28/src/services/ServiceProxies.ts b/vben28/src/services/ServiceProxies.ts index 3164a3e4..f371086d 100644 --- a/vben28/src/services/ServiceProxies.ts +++ b/vben28/src/services/ServiceProxies.ts @@ -2917,12 +2917,12 @@ export class NotificationServiceProxy extends ServiceProxyBase { } /** - * 分页获取用户普通文本消息 + * 分页获取文本消息 * @param body (optional) * @return Success */ - common(body: PagingNotificationListInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/Notification/Common"; + notificationPage(body: PagingNotificationInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/Notification/NotificationPage"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -2947,11 +2947,11 @@ export class NotificationServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processCommon(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processNotificationPage(_response)); }); } - protected processCommon(response: AxiosResponse): Promise { + protected processNotificationPage(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -2965,8 +2965,8 @@ export class NotificationServiceProxy extends ServiceProxyBase { const _responseText = response.data; let result200: any = null; let resultData200 = _responseText; - result200 = PagingNotificationListOutputPagedResultDto.fromJS(resultData200); - return Promise.resolve(result200); + result200 = PagingNotificationOutputPagedResultDto.fromJS(resultData200); + return Promise.resolve(result200); } else if (status === 403) { const _responseText = response.data; @@ -3014,16 +3014,16 @@ export class NotificationServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null as any); + return Promise.resolve(null as any); } /** - * 分页获取广播消息 + * 分页获取广播消息已读人数 * @param body (optional) * @return Success */ - broadCast(body: PagingNotificationListInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/Notification/BroadCast"; + notificationSubscriptionPage(body: PagingNotificationSubscriptionInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/Notification/NotificationSubscriptionPage"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); @@ -3048,11 +3048,11 @@ export class NotificationServiceProxy extends ServiceProxyBase { throw _error; } }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processBroadCast(_response)); + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processNotificationSubscriptionPage(_response)); }); } - protected processBroadCast(response: AxiosResponse): Promise { + protected processNotificationSubscriptionPage(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -3066,8 +3066,8 @@ export class NotificationServiceProxy extends ServiceProxyBase { const _responseText = response.data; let result200: any = null; let resultData200 = _responseText; - result200 = PagingNotificationListOutputPagedResultDto.fromJS(resultData200); - return Promise.resolve(result200); + result200 = PagingNotificationSubscriptionOutputPagedResultDto.fromJS(resultData200); + return Promise.resolve(result200); } else if (status === 403) { const _responseText = response.data; @@ -3115,7 +3115,7 @@ export class NotificationServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null as any); + return Promise.resolve(null as any); } /** @@ -6846,6 +6846,114 @@ export class UsersServiceProxy extends ServiceProxyBase { return Promise.resolve(null as any); } + /** + * 分页获取用户信息 + * @param body (optional) + * @return Success + */ + list(body: PagingUserListInput | undefined , cancelToken?: CancelToken | undefined): Promise { + let url_ = this.baseUrl + "/Users/list"; + url_ = url_.replace(/[?&]$/, ""); + + const content_ = JSON.stringify(body); + + let options_ = { + data: content_, + method: "POST", + url: url_, + headers: { + "Content-Type": "application/json", + "Accept": "text/plain" + }, + cancelToken + }; + + return this.transformOptions(options_).then(transformedOptions_ => { + return this.instance.request(transformedOptions_); + }).catch((_error: any) => { + if (isAxiosError(_error) && _error.response) { + return _error.response; + } else { + throw _error; + } + }).then((_response: AxiosResponse) => { + return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processList(_response)); + }); + } + + protected processList(response: AxiosResponse): Promise { + const status = response.status; + let _headers: any = {}; + if (response.headers && typeof response.headers === "object") { + for (let k in response.headers) { + if (response.headers.hasOwnProperty(k)) { + _headers[k] = response.headers[k]; + } + } + } + if (status === 200) { + const _responseText = response.data; + let result200: any = null; + let resultData200 = _responseText; + if (Array.isArray(resultData200)) { + result200 = [] as any; + for (let item of resultData200) + result200!.push(IdentityUserDto.fromJS(item)); + } + else { + result200 = null; + } + return Promise.resolve(result200); + + } else if (status === 403) { + const _responseText = response.data; + let result403: any = null; + let resultData403 = _responseText; + result403 = RemoteServiceErrorResponse.fromJS(resultData403); + return throwException("Forbidden", status, _responseText, _headers, result403); + + } else if (status === 401) { + const _responseText = response.data; + let result401: any = null; + let resultData401 = _responseText; + result401 = RemoteServiceErrorResponse.fromJS(resultData401); + return throwException("Unauthorized", status, _responseText, _headers, result401); + + } else if (status === 400) { + const _responseText = response.data; + let result400: any = null; + let resultData400 = _responseText; + result400 = RemoteServiceErrorResponse.fromJS(resultData400); + return throwException("Bad Request", status, _responseText, _headers, result400); + + } else if (status === 404) { + const _responseText = response.data; + let result404: any = null; + let resultData404 = _responseText; + result404 = RemoteServiceErrorResponse.fromJS(resultData404); + return throwException("Not Found", status, _responseText, _headers, result404); + + } else if (status === 501) { + const _responseText = response.data; + let result501: any = null; + let resultData501 = _responseText; + result501 = RemoteServiceErrorResponse.fromJS(resultData501); + return throwException("Server Error", status, _responseText, _headers, result501); + + } else if (status === 500) { + const _responseText = response.data; + let result500: any = null; + let resultData500 = _responseText; + result500 = RemoteServiceErrorResponse.fromJS(resultData500); + return throwException("Server Error", status, _responseText, _headers, result500); + + } else if (status !== 200 && status !== 204) { + const _responseText = response.data; + return throwException("An unexpected server error occurred.", status, _responseText, _headers); + } + return Promise.resolve(null as any); + } + /** * 导出用户列表 * @param body (optional) @@ -15113,15 +15221,34 @@ export interface IPagingIdentitySecurityLogOutputPagedResultDto { totalCount: number; } -export class PagingNotificationListInput implements IPagingNotificationListInput { +export class PagingNotificationInput implements IPagingNotificationInput { /** 当前页面.默认从1开始 */ pageIndex!: number; /** 每页多少条.每页显示多少记录 */ pageSize!: number; /** 跳过多少条 */ readonly skipCount!: number; + /** 标题 */ + title!: string | undefined; + /** 内容 */ + content!: string | undefined; + /** 发送者Id */ + senderUserId!: string | undefined; + /** 发送者名称 */ + senderUserName!: string | undefined; + /** 接受者Id */ + receiverUserId!: string | undefined; + /** 接受者名称 */ + receiverUserName!: string | undefined; + /** 是否已读 */ + read!: boolean | undefined; + /** 已读开始时间 */ + startReadTime!: dayjs.Dayjs | undefined; + /** 已读结束时间 */ + endReadTime!: dayjs.Dayjs | undefined; + messageType!: MessageType; - constructor(data?: IPagingNotificationListInput) { + constructor(data?: IPagingNotificationInput) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) @@ -15135,12 +15262,22 @@ export class PagingNotificationListInput implements IPagingNotificationListInput this.pageIndex = _data["pageIndex"]; this.pageSize = _data["pageSize"]; (this).skipCount = _data["skipCount"]; + this.title = _data["title"]; + this.content = _data["content"]; + this.senderUserId = _data["senderUserId"]; + this.senderUserName = _data["senderUserName"]; + this.receiverUserId = _data["receiverUserId"]; + this.receiverUserName = _data["receiverUserName"]; + this.read = _data["read"]; + this.startReadTime = _data["startReadTime"] ? dayjs(_data["startReadTime"].toString()) : undefined; + this.endReadTime = _data["endReadTime"] ? dayjs(_data["endReadTime"].toString()) : undefined; + this.messageType = _data["messageType"]; } } - static fromJS(data: any): PagingNotificationListInput { + static fromJS(data: any): PagingNotificationInput { data = typeof data === 'object' ? data : {}; - let result = new PagingNotificationListInput(); + let result = new PagingNotificationInput(); result.init(data); return result; } @@ -15150,37 +15287,77 @@ export class PagingNotificationListInput implements IPagingNotificationListInput data["pageIndex"] = this.pageIndex; data["pageSize"] = this.pageSize; data["skipCount"] = this.skipCount; + data["title"] = this.title; + data["content"] = this.content; + data["senderUserId"] = this.senderUserId; + data["senderUserName"] = this.senderUserName; + data["receiverUserId"] = this.receiverUserId; + data["receiverUserName"] = this.receiverUserName; + data["read"] = this.read; + data["startReadTime"] = this.startReadTime ? this.startReadTime.toLocaleString() : undefined; + data["endReadTime"] = this.endReadTime ? this.endReadTime.toLocaleString() : undefined; + data["messageType"] = this.messageType; return data; } } -export interface IPagingNotificationListInput { +export interface IPagingNotificationInput { /** 当前页面.默认从1开始 */ pageIndex: number; /** 每页多少条.每页显示多少记录 */ pageSize: number; /** 跳过多少条 */ skipCount: number; + /** 标题 */ + title: string | undefined; + /** 内容 */ + content: string | undefined; + /** 发送者Id */ + senderUserId: string | undefined; + /** 发送者名称 */ + senderUserName: string | undefined; + /** 接受者Id */ + receiverUserId: string | undefined; + /** 接受者名称 */ + receiverUserName: string | undefined; + /** 是否已读 */ + read: boolean | undefined; + /** 已读开始时间 */ + startReadTime: dayjs.Dayjs | undefined; + /** 已读结束时间 */ + endReadTime: dayjs.Dayjs | undefined; + messageType: MessageType; } -export class PagingNotificationListOutput implements IPagingNotificationListOutput { +export class PagingNotificationOutput implements IPagingNotificationOutput { id!: string; + /** 租户id */ + tenantId!: string | undefined; /** 消息标题 */ title!: string | undefined; /** 消息内容 */ content!: string | undefined; messageType!: MessageType; - readonly messageTypeDescription!: string | undefined; + readonly messageTypeName!: string | undefined; messageLevel!: MessageLevel; - readonly messageLevelDescription!: string | undefined; + readonly messageLevelName!: string | undefined; /** 发送人 */ - senderId!: string; - /** 创建时间 */ - creationTime!: dayjs.Dayjs; + senderUserId!: string; + /** 发送人用户名 */ + senderUserName!: string | undefined; + /** 订阅人 +消息类型是广播消息时,订阅人为空 */ + receiveUserId!: string | undefined; + /** 接收人用户名 +消息类型是广播消息时,订接收人用户名为空 */ + receiveUserName!: string | undefined; /** 是否已读 */ read!: boolean; + /** 已读时间 */ + readTime!: dayjs.Dayjs | undefined; + creationTime!: dayjs.Dayjs; - constructor(data?: IPagingNotificationListOutput) { + constructor(data?: IPagingNotificationOutput) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) @@ -15192,21 +15369,26 @@ export class PagingNotificationListOutput implements IPagingNotificationListOutp init(_data?: any) { if (_data) { this.id = _data["id"]; + this.tenantId = _data["tenantId"]; this.title = _data["title"]; this.content = _data["content"]; this.messageType = _data["messageType"]; - (this).messageTypeDescription = _data["messageTypeDescription"]; + (this).messageTypeName = _data["messageTypeName"]; this.messageLevel = _data["messageLevel"]; - (this).messageLevelDescription = _data["messageLevelDescription"]; - this.senderId = _data["senderId"]; - this.creationTime = _data["creationTime"] ? dayjs(_data["creationTime"].toString()) : undefined; + (this).messageLevelName = _data["messageLevelName"]; + this.senderUserId = _data["senderUserId"]; + this.senderUserName = _data["senderUserName"]; + this.receiveUserId = _data["receiveUserId"]; + this.receiveUserName = _data["receiveUserName"]; this.read = _data["read"]; + this.readTime = _data["readTime"] ? dayjs(_data["readTime"].toString()) : undefined; + this.creationTime = _data["creationTime"] ? dayjs(_data["creationTime"].toString()) : undefined; } } - static fromJS(data: any): PagingNotificationListOutput { + static fromJS(data: any): PagingNotificationOutput { data = typeof data === 'object' ? data : {}; - let result = new PagingNotificationListOutput(); + let result = new PagingNotificationOutput(); result.init(data); return result; } @@ -15214,42 +15396,302 @@ export class PagingNotificationListOutput implements IPagingNotificationListOutp toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["id"] = this.id; + data["tenantId"] = this.tenantId; data["title"] = this.title; data["content"] = this.content; data["messageType"] = this.messageType; - data["messageTypeDescription"] = this.messageTypeDescription; + data["messageTypeName"] = this.messageTypeName; data["messageLevel"] = this.messageLevel; - data["messageLevelDescription"] = this.messageLevelDescription; - data["senderId"] = this.senderId; - data["creationTime"] = this.creationTime ? this.creationTime.toLocaleString() : undefined; + data["messageLevelName"] = this.messageLevelName; + data["senderUserId"] = this.senderUserId; + data["senderUserName"] = this.senderUserName; + data["receiveUserId"] = this.receiveUserId; + data["receiveUserName"] = this.receiveUserName; data["read"] = this.read; + data["readTime"] = this.readTime ? this.readTime.toLocaleString() : undefined; + data["creationTime"] = this.creationTime ? this.creationTime.toLocaleString() : undefined; return data; } } -export interface IPagingNotificationListOutput { +export interface IPagingNotificationOutput { id: string; + /** 租户id */ + tenantId: string | undefined; /** 消息标题 */ title: string | undefined; /** 消息内容 */ content: string | undefined; messageType: MessageType; - messageTypeDescription: string | undefined; + messageTypeName: string | undefined; messageLevel: MessageLevel; - messageLevelDescription: string | undefined; + messageLevelName: string | undefined; /** 发送人 */ - senderId: string; - /** 创建时间 */ + senderUserId: string; + /** 发送人用户名 */ + senderUserName: string | undefined; + /** 订阅人 +消息类型是广播消息时,订阅人为空 */ + receiveUserId: string | undefined; + /** 接收人用户名 +消息类型是广播消息时,订接收人用户名为空 */ + receiveUserName: string | undefined; + /** 是否已读 */ + read: boolean; + /** 已读时间 */ + readTime: dayjs.Dayjs | undefined; creationTime: dayjs.Dayjs; +} + +export class PagingNotificationOutputPagedResultDto implements IPagingNotificationOutputPagedResultDto { + items!: PagingNotificationOutput[] | undefined; + totalCount!: number; + + constructor(data?: IPagingNotificationOutputPagedResultDto) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + if (Array.isArray(_data["items"])) { + this.items = [] as any; + for (let item of _data["items"]) + this.items!.push(PagingNotificationOutput.fromJS(item)); + } + this.totalCount = _data["totalCount"]; + } + } + + static fromJS(data: any): PagingNotificationOutputPagedResultDto { + data = typeof data === 'object' ? data : {}; + let result = new PagingNotificationOutputPagedResultDto(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + if (Array.isArray(this.items)) { + data["items"] = []; + for (let item of this.items) + data["items"].push(item.toJSON()); + } + data["totalCount"] = this.totalCount; + return data; + } +} + +export interface IPagingNotificationOutputPagedResultDto { + items: PagingNotificationOutput[] | undefined; + totalCount: number; +} + +export class PagingNotificationSubscriptionInput implements IPagingNotificationSubscriptionInput { + /** 当前页面.默认从1开始 */ + pageIndex!: number; + /** 每页多少条.每页显示多少记录 */ + pageSize!: number; + /** 跳过多少条 */ + readonly skipCount!: number; + notificationId!: string; + /** 接受者Id */ + receiverUserId!: string | undefined; + /** 接受者名称 */ + receiverUserName!: string | undefined; + /** 是否已读 */ + read!: boolean | undefined; + /** 已读开始时间 */ + startReadTime!: dayjs.Dayjs | undefined; + /** 已读结束时间 */ + endReadTime!: dayjs.Dayjs | undefined; + + constructor(data?: IPagingNotificationSubscriptionInput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.pageIndex = _data["pageIndex"]; + this.pageSize = _data["pageSize"]; + (this).skipCount = _data["skipCount"]; + this.notificationId = _data["notificationId"]; + this.receiverUserId = _data["receiverUserId"]; + this.receiverUserName = _data["receiverUserName"]; + this.read = _data["read"]; + this.startReadTime = _data["startReadTime"] ? dayjs(_data["startReadTime"].toString()) : undefined; + this.endReadTime = _data["endReadTime"] ? dayjs(_data["endReadTime"].toString()) : undefined; + } + } + + static fromJS(data: any): PagingNotificationSubscriptionInput { + data = typeof data === 'object' ? data : {}; + let result = new PagingNotificationSubscriptionInput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["pageIndex"] = this.pageIndex; + data["pageSize"] = this.pageSize; + data["skipCount"] = this.skipCount; + data["notificationId"] = this.notificationId; + data["receiverUserId"] = this.receiverUserId; + data["receiverUserName"] = this.receiverUserName; + data["read"] = this.read; + data["startReadTime"] = this.startReadTime ? this.startReadTime.toLocaleString() : undefined; + data["endReadTime"] = this.endReadTime ? this.endReadTime.toLocaleString() : undefined; + return data; + } +} + +export interface IPagingNotificationSubscriptionInput { + /** 当前页面.默认从1开始 */ + pageIndex: number; + /** 每页多少条.每页显示多少记录 */ + pageSize: number; + /** 跳过多少条 */ + skipCount: number; + notificationId: string; + /** 接受者Id */ + receiverUserId: string | undefined; + /** 接受者名称 */ + receiverUserName: string | undefined; + /** 是否已读 */ + read: boolean | undefined; + /** 已读开始时间 */ + startReadTime: dayjs.Dayjs | undefined; + /** 已读结束时间 */ + endReadTime: dayjs.Dayjs | undefined; +} + +export class PagingNotificationSubscriptionOutput implements IPagingNotificationSubscriptionOutput { + id!: string; + /** 租户id */ + tenantId!: string | undefined; + /** 消息Id */ + notificationId!: string; + /** 接收人id */ + receiveUserId!: string; + /** 接收人用户名 */ + receiveUserName!: string | undefined; + /** 是否已读 */ + read!: boolean; + /** 已读时间 */ + readTime!: dayjs.Dayjs; + /** 消息标题 */ + title!: string | undefined; + /** 消息内容 */ + content!: string | undefined; + messageType!: MessageType; + readonly messageTypeName!: string | undefined; + messageLevel!: MessageLevel; + readonly messageLevelName!: string | undefined; + /** 发送人 */ + senderUserId!: string; + /** 发送人用户名 */ + senderUserName!: string | undefined; + + constructor(data?: IPagingNotificationSubscriptionOutput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.id = _data["id"]; + this.tenantId = _data["tenantId"]; + this.notificationId = _data["notificationId"]; + this.receiveUserId = _data["receiveUserId"]; + this.receiveUserName = _data["receiveUserName"]; + this.read = _data["read"]; + this.readTime = _data["readTime"] ? dayjs(_data["readTime"].toString()) : undefined; + this.title = _data["title"]; + this.content = _data["content"]; + this.messageType = _data["messageType"]; + (this).messageTypeName = _data["messageTypeName"]; + this.messageLevel = _data["messageLevel"]; + (this).messageLevelName = _data["messageLevelName"]; + this.senderUserId = _data["senderUserId"]; + this.senderUserName = _data["senderUserName"]; + } + } + + static fromJS(data: any): PagingNotificationSubscriptionOutput { + data = typeof data === 'object' ? data : {}; + let result = new PagingNotificationSubscriptionOutput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["id"] = this.id; + data["tenantId"] = this.tenantId; + data["notificationId"] = this.notificationId; + data["receiveUserId"] = this.receiveUserId; + data["receiveUserName"] = this.receiveUserName; + data["read"] = this.read; + data["readTime"] = this.readTime ? this.readTime.toLocaleString() : undefined; + data["title"] = this.title; + data["content"] = this.content; + data["messageType"] = this.messageType; + data["messageTypeName"] = this.messageTypeName; + data["messageLevel"] = this.messageLevel; + data["messageLevelName"] = this.messageLevelName; + data["senderUserId"] = this.senderUserId; + data["senderUserName"] = this.senderUserName; + return data; + } +} + +export interface IPagingNotificationSubscriptionOutput { + id: string; + /** 租户id */ + tenantId: string | undefined; + /** 消息Id */ + notificationId: string; + /** 接收人id */ + receiveUserId: string; + /** 接收人用户名 */ + receiveUserName: string | undefined; /** 是否已读 */ read: boolean; + /** 已读时间 */ + readTime: dayjs.Dayjs; + /** 消息标题 */ + title: string | undefined; + /** 消息内容 */ + content: string | undefined; + messageType: MessageType; + messageTypeName: string | undefined; + messageLevel: MessageLevel; + messageLevelName: string | undefined; + /** 发送人 */ + senderUserId: string; + /** 发送人用户名 */ + senderUserName: string | undefined; } -export class PagingNotificationListOutputPagedResultDto implements IPagingNotificationListOutputPagedResultDto { - items!: PagingNotificationListOutput[] | undefined; +export class PagingNotificationSubscriptionOutputPagedResultDto implements IPagingNotificationSubscriptionOutputPagedResultDto { + items!: PagingNotificationSubscriptionOutput[] | undefined; totalCount!: number; - constructor(data?: IPagingNotificationListOutputPagedResultDto) { + constructor(data?: IPagingNotificationSubscriptionOutputPagedResultDto) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) @@ -15263,15 +15705,15 @@ export class PagingNotificationListOutputPagedResultDto implements IPagingNotifi if (Array.isArray(_data["items"])) { this.items = [] as any; for (let item of _data["items"]) - this.items!.push(PagingNotificationListOutput.fromJS(item)); + this.items!.push(PagingNotificationSubscriptionOutput.fromJS(item)); } this.totalCount = _data["totalCount"]; } } - static fromJS(data: any): PagingNotificationListOutputPagedResultDto { + static fromJS(data: any): PagingNotificationSubscriptionOutputPagedResultDto { data = typeof data === 'object' ? data : {}; - let result = new PagingNotificationListOutputPagedResultDto(); + let result = new PagingNotificationSubscriptionOutputPagedResultDto(); result.init(data); return result; } @@ -15288,8 +15730,8 @@ export class PagingNotificationListOutputPagedResultDto implements IPagingNotifi } } -export interface IPagingNotificationListOutputPagedResultDto { - items: PagingNotificationListOutput[] | undefined; +export interface IPagingNotificationSubscriptionOutputPagedResultDto { + items: PagingNotificationSubscriptionOutput[] | undefined; totalCount: number; } @@ -16055,7 +16497,9 @@ export class SendCommonMessageInput implements ISendCommonMessageInput { /** 消息内容 */ content!: string | undefined; /** 发送人 */ - receiveIds!: string[] | undefined; + receiveUserId!: string; + /** 发送人名称 */ + receiveUserName!: string | undefined; constructor(data?: ISendCommonMessageInput) { if (data) { @@ -16070,11 +16514,8 @@ export class SendCommonMessageInput implements ISendCommonMessageInput { if (_data) { this.title = _data["title"]; this.content = _data["content"]; - if (Array.isArray(_data["receiveIds"])) { - this.receiveIds = [] as any; - for (let item of _data["receiveIds"]) - this.receiveIds!.push(item); - } + this.receiveUserId = _data["receiveUserId"]; + this.receiveUserName = _data["receiveUserName"]; } } @@ -16089,11 +16530,8 @@ export class SendCommonMessageInput implements ISendCommonMessageInput { data = typeof data === 'object' ? data : {}; data["title"] = this.title; data["content"] = this.content; - if (Array.isArray(this.receiveIds)) { - data["receiveIds"] = []; - for (let item of this.receiveIds) - data["receiveIds"].push(item); - } + data["receiveUserId"] = this.receiveUserId; + data["receiveUserName"] = this.receiveUserName; return data; } } @@ -16104,7 +16542,9 @@ export interface ISendCommonMessageInput { /** 消息内容 */ content: string | undefined; /** 发送人 */ - receiveIds: string[] | undefined; + receiveUserId: string; + /** 发送人名称 */ + receiveUserName: string | undefined; } export class SetDataDictinaryDetailInput implements ISetDataDictinaryDetailInput { diff --git a/vben28/src/views/admin/notification/CreateNotification.vue b/vben28/src/views/admin/notification/CreateNotification.vue new file mode 100644 index 00000000..f4daa1f1 --- /dev/null +++ b/vben28/src/views/admin/notification/CreateNotification.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/vben28/src/views/admin/notification/CreateSubscription.vue b/vben28/src/views/admin/notification/CreateSubscription.vue new file mode 100644 index 00000000..aa20810b --- /dev/null +++ b/vben28/src/views/admin/notification/CreateSubscription.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/vben28/src/views/admin/notification/Index.ts b/vben28/src/views/admin/notification/Index.ts new file mode 100644 index 00000000..ec0822b6 --- /dev/null +++ b/vben28/src/views/admin/notification/Index.ts @@ -0,0 +1,396 @@ +import { FormSchema } from '/@/components/Table'; +import { BasicColumn } from '/@/components/Table'; +import { + NotificationServiceProxy, + PagingNotificationSubscriptionInput, + PagingNotificationInput, + PagingUserListInput, + UsersServiceProxy +} from '/@/services/ServiceProxies'; +import { useI18n } from '/@/hooks/web/useI18n'; +import { formatToDateTime, dateUtil } from '/@/utils/dateUtil'; +const { t } = useI18n(); +// 分页表格消息通知 BasicColumn +export const tableColumns: BasicColumn[] = [ + { + title: t('routes.admin.notificationManagement_title'), + dataIndex: 'title', + width: 200, + }, + { + title: t('routes.admin.notificationManagement_content'), + dataIndex: 'content', + }, + // { + // title: t('routes.admin.notificationManagement_messageType'), + // dataIndex: 'messageTypeName', + // width: 100, + // }, + { + title: t('routes.admin.notificationManagement_messageLevel'), + dataIndex: 'messageLevelName', + width: 100, + }, + + { + title: t('routes.admin.notificationManagement_senderUserName'), + dataIndex: 'senderUserName', + width: 100, + }, + + { + title: t('routes.admin.notificationManagement_receiveUserName'), + dataIndex: 'receiveUserName', + width: 100, + }, + { + title: t('routes.admin.notificationManagement_read'), + dataIndex: 'read', + width: 100, + }, + { + title: t('routes.admin.notificationManagement_readTime'), + dataIndex: 'readTime', + customRender: ({ text }) => { + return formatToDateTime(text); + }, + width: 250, + }, +]; + +// 分页查询消息通知 FormSchema +export const searchFormSchema: FormSchema[] = [ + { + field: 'title', + label: t('routes.admin.notificationManagement_title'), + component: "Input", + colProps: { span: 4 } + }, + { + field: 'content', + label: t('routes.admin.notificationManagement_content'), + component: "Input", + colProps: { span: 6 } + }, + { + field: 'messageType', + label: t('routes.admin.notificationManagement_messageType'), + component: "Input", + required: true, + defaultValue: 20, + show: false, + colProps: { span: 18 } + }, + { + field: 'messageLevel', + component: 'Select', + label: t('routes.admin.notificationManagement_messageLevel'), + + colProps: { + span: 2, + }, + componentProps: { + options: [ + { + label: '警告', + value: 10, + }, + { + label: '正常', + value: 20, + }, + { + label: '错误', + value: 30, + }, + ], + }, + }, + { + field: 'read', + component: 'Select', + label: t('routes.admin.notificationManagement_read'), + + colProps: { + span: 2, + }, + componentProps: { + options: [ + { + label: '是', + value: true, + }, + { + label: '否', + value: false, + } + ], + }, + }, + +]; + +// 创建消息通知 FormSchema +export const createFormSchema: FormSchema[] = [ + { + field: 'title', + label: t('routes.admin.notificationManagement_title'), + component: "Input", + required: true, + colProps: { span: 18 } + }, + { + field: 'content', + label: t('routes.admin.notificationManagement_content'), + component: "Input", + required: true, + colProps: { span: 18 } + }, + { + field: 'messageLevel', + component: 'Select', + label: t('routes.admin.notificationManagement_messageLevel'), + defaultValue: 20, + colProps: { span: 18 }, + componentProps: { + options: [ + { + label: '警告', + value: 10, + }, + { + label: '正常', + value: 20, + }, + { + label: '错误', + value: 30, + }, + ], + }, + }, + { + field: 'receiveUserId', + label: t('routes.admin.notificationManagement_receiveUserName'), + labelWidth: 120, + component: 'ApiSelect', + colProps: { span: 18 }, + componentProps: ({ formModel }) => { + return { + api: getUserListAsync, + labelField: 'userName', + valueField: 'id', + showSearch: true, + optionFilterProp: 'label', + onChange: async (e: any, options : any) => { + formModel.receiveUserName = options.name; + }, + }; + }, + }, + { + field: 'receiveUserName', + label: 'ReceiveUserName', + component: "Input", + required: true, + show: false, + colProps: { span: 18 } + }, +]; + +// 创建消息通知 FormSchema +export const createSubscriptionFormSchema: FormSchema[] = [ + { + field: 'title', + label: t('routes.admin.notificationManagement_title'), + component: "Input", + required: true, + colProps: { span: 18 } + }, + { + field: 'content', + label: t('routes.admin.notificationManagement_content'), + component: "Input", + required: true, + colProps: { span: 18 } + }, + { + field: 'messageLevel', + component: 'Select', + label: t('routes.admin.notificationManagement_messageLevel'), + defaultValue: 20, + colProps: { span: 18 }, + componentProps: { + options: [ + { + label: '警告', + value: 10, + }, + { + label: '正常', + value: 20, + }, + { + label: '错误', + value: 30, + }, + ], + }, + } +]; + + +// 分页查询消息通知 FormSchema +export const searchSubscriptionFormSchema: FormSchema[] = [ + { + field: 'title', + label: t('routes.admin.notificationManagement_title'), + component: "Input", + colProps: { span: 4 } + }, + { + field: 'content', + label: t('routes.admin.notificationManagement_content'), + component: "Input", + colProps: { span: 6 } + }, + { + field: 'messageType', + label: t('routes.admin.notificationManagement_messageType'), + component: "Input", + required: true, + defaultValue: 10, + show: false, + colProps: { span: 18 } + }, + { + field: 'messageLevel', + component: 'Select', + label: t('routes.admin.notificationManagement_messageLevel'), + + colProps: { + span: 2, + }, + componentProps: { + options: [ + { + label: '警告', + value: 10, + }, + { + label: '正常', + value: 20, + }, + { + label: '错误', + value: 30, + }, + ], + }, + }, +]; +// 分页表格消息通知 BasicColumn +export const tableSubscriptionColumns: BasicColumn[] = [ + { + title: t('routes.admin.notificationManagement_title'), + dataIndex: 'title', + width: 200, + }, + { + title: t('routes.admin.notificationManagement_content'), + dataIndex: 'content', + }, + // { + // title: t('routes.admin.notificationManagement_messageType'), + // dataIndex: 'messageTypeName', + // width: 100, + // }, + { + title: t('routes.admin.notificationManagement_messageLevel'), + dataIndex: 'messageLevelName', + width: 100, + }, + + { + title: t('routes.admin.notificationManagement_senderUserName'), + dataIndex: 'senderUserName', + width: 100, + }, + { + title: t('routes.admin.userManagement_createTime'), + dataIndex: 'creationTime', + customRender: ({ text }) => { + return dateUtil(text).format('YYYY-MM-DD HH:mm:ss'); + }, + width: 250, + }, +]; + +/** + * 分页查询消息通知 + */ +export async function notificationPageAsync(params: PagingNotificationInput, +) { + const notificationServiceProxy = new NotificationServiceProxy(); + return notificationServiceProxy.notificationPage(params); +} + +/** + * 分页查询消息通知 + */ +export async function notificationSubscriptionPageAsync(params: PagingNotificationSubscriptionInput, +) { + const notificationServiceProxy = new NotificationServiceProxy(); + return notificationServiceProxy.notificationSubscriptionPage(params); +} + +export async function setReadAsync(request) { + const _notificationServiceProxy = new NotificationServiceProxy(); + await _notificationServiceProxy.read(request); +} + + +/** + * 创建消息通知 + */ +export async function sendNotificationAsync({ params }) { + const notificationServiceProxy = new NotificationServiceProxy(); + if (params.messageLevel == 10) { + await notificationServiceProxy.sendCommonWarningMessage(params); + } + if (params.messageLevel == 20) { + await notificationServiceProxy.sendCommonInformationMessage(params); + } + if (params.messageLevel == 30) { + await notificationServiceProxy.sendCommonErrorMessage(params); + } +} + + +/** + * 创建消息通知 + */ +export async function sendNotificationSubscriptionAsync({ params }) { + const notificationServiceProxy = new NotificationServiceProxy(); + if (params.messageLevel == 10) { + await notificationServiceProxy.sendBroadCastWarningMessage(params); + } + if (params.messageLevel == 20) { + await notificationServiceProxy.sendBroadCastInformationMessage(params); + } + if (params.messageLevel == 30) { + await notificationServiceProxy.sendBroadCastErrorMessage(params); + } +} + +/** + * 获取用户列表 + * @param params + * @returns + */ +export async function getUserListAsync( + params: PagingUserListInput, +) { + const _userServiceProxy = new UsersServiceProxy(); + return _userServiceProxy.list(params); +} \ No newline at end of file diff --git a/vben28/src/views/admin/notification/Index.vue b/vben28/src/views/admin/notification/Index.vue new file mode 100644 index 00000000..d23a0016 --- /dev/null +++ b/vben28/src/views/admin/notification/Index.vue @@ -0,0 +1,107 @@ + + + diff --git a/vben28/src/views/admin/notification/Subscription.vue b/vben28/src/views/admin/notification/Subscription.vue new file mode 100644 index 00000000..2cff8b67 --- /dev/null +++ b/vben28/src/views/admin/notification/Subscription.vue @@ -0,0 +1,76 @@ + + +