From 1debba1829e270c6b426da27c15ad56c0a880e53 Mon Sep 17 00:00:00 2001 From: GameBelial <243387971@qq.com> Date: Mon, 1 Mar 2021 22:32:37 +0800 Subject: [PATCH 001/101] Add support for RabbitMQ cluster. --- .../Volo/Abp/RabbitMQ/ConnectionPool.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs index 5856f7bb16..7ca8346d11 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs @@ -26,10 +26,13 @@ namespace Volo.Abp.RabbitMQ return Connections.GetOrAdd( connectionName, - () => Options - .Connections - .GetOrDefault(connectionName) - .CreateConnection() + () => + { + var connection = Options.Connections.GetOrDefault(connectionName); + var hostnames = connection.HostName.TrimEnd(';').Split(';'); + // Handle Rabbit MQ Cluster. + return hostnames.Length == 1 ? connection.CreateConnection() : connection.CreateConnection(hostnames); + } ); } From fc9ade905d395578aa9073b7697dabb3c34bd024 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 1 Mar 2021 18:05:37 +0300 Subject: [PATCH 002/101] Added EntityType to mediadescriptopr entity --- .../Admin/MediaDescriptors/CreateMediaInputStream.cs | 4 ++++ .../MediaDescriptors/MediaDescriptorAdminAppService.cs | 2 +- .../MediaDescriptors/MediaDescriptorAdminController.cs | 4 +++- .../Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs | 6 +++++- .../Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs | 8 +++++--- .../{MediaDescriptorCheck.cs => MediaDescriptorChecks.cs} | 4 ++-- .../CmsKitDbContextModelCreatingExtensions.cs | 1 + .../Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs | 2 +- .../cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs | 3 +++ 9 files changed, 25 insertions(+), 9 deletions(-) rename modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/{MediaDescriptorCheck.cs => MediaDescriptorChecks.cs} (77%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputStream.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputStream.cs index b61d50e124..0f66ab5fef 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputStream.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/MediaDescriptors/CreateMediaInputStream.cs @@ -8,6 +8,10 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { public class CreateMediaInputStream : RemoteStreamContent { + [Required] + [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxEntityTypeLength))] + public string EntityType { get; set; } + [Required] [DynamicStringLength(typeof(MediaDescriptorConsts), nameof(MediaDescriptorConsts.MaxNameLength))] public string Name { get; set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 17af6a9993..ee2b5af152 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -27,7 +27,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { var newId = GuidGenerator.Create(); var stream = inputStream.GetStream(); - var newEntity = new MediaDescriptor(newId, inputStream.Name, inputStream.ContentType, stream.Length, CurrentTenant.Id); + var newEntity = new MediaDescriptor(newId, inputStream.EntityType, inputStream.Name, inputStream.ContentType, stream.Length, CurrentTenant.Id); await MediaContainer.SaveAsync(newId.ToString(), stream); await MediaDescriptorRepository.InsertAsync(newEntity); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index 4267f635b0..124cfcba1c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -42,8 +42,9 @@ namespace Volo.CmsKit.Admin.MediaDescriptors } [HttpPost] + [Route("{entityType}")] [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] - public virtual async Task UploadAsync(IFormFile file) + public virtual async Task UploadAsync(string entityType, IFormFile file) { if (file == null) { @@ -52,6 +53,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors var inputStream = new CreateMediaInputStream(file.OpenReadStream()) { + EntityType = entityType, ContentType = file.ContentType, Name = file.FileName }; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs index 5f4741828e..31737fa9fe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/MediaDescriptors/MediaDescriptorConsts.cs @@ -1,7 +1,11 @@ -namespace Volo.CmsKit.MediaDescriptors +using Volo.CmsKit.Entities; + +namespace Volo.CmsKit.MediaDescriptors { public class MediaDescriptorConsts { + public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; + public static int MaxNameLength { get; set; } = 255; public static int MaxMimeTypeLength { get; set; } = 128; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index 3829a3afef..c97eb26b9a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -2,13 +2,14 @@ using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; -using Volo.CmsKit.MediaDescriptors.Extensions; namespace Volo.CmsKit.MediaDescriptors { public class MediaDescriptor : FullAuditedAggregateRoot, IMultiTenant { public Guid? TenantId { get; protected set; } + + public string EntityType { get; set; } public string Name { get; protected set; } @@ -21,10 +22,11 @@ namespace Volo.CmsKit.MediaDescriptors } - public MediaDescriptor(Guid id, string name, string mimeType, long size, Guid? tenantId = null) : base(id) + public MediaDescriptor(Guid id, string entityType, string name, string mimeType, long size, Guid? tenantId = null) : base(id) { TenantId = tenantId; + EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), MediaDescriptorConsts.MaxEntityTypeLength); MimeType = Check.NotNullOrWhiteSpace(mimeType, nameof(name), MediaDescriptorConsts.MaxMimeTypeLength); Size = size; @@ -33,7 +35,7 @@ namespace Volo.CmsKit.MediaDescriptors public void SetName(string name) { - if (!MediaDescriptorCheck.IsValidMediaFileName(name)) + if (!MediaDescriptorChecks.IsValidMediaFileName(name)) { throw new InvalidMediaDescriptorNameException(name); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorCheck.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorChecks.cs similarity index 77% rename from modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorCheck.cs rename to modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorChecks.cs index 5ef0c4497a..1881de83e3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorCheck.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorChecks.cs @@ -1,9 +1,9 @@ using System.IO; using System.Linq; -namespace Volo.CmsKit.MediaDescriptors.Extensions +namespace Volo.CmsKit.MediaDescriptors { - public static class MediaDescriptorCheck + public static class MediaDescriptorChecks { public static bool IsValidMediaFileName(string name) { diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 2f7308be95..476e2a3111 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -242,6 +242,7 @@ namespace Volo.CmsKit.EntityFrameworkCore b.ConfigureByConvention(); + b.Property(x => x.EntityType).IsRequired().HasMaxLength(MediaDescriptorConsts.MaxEntityTypeLength); b.Property(x => x.Name).IsRequired().HasMaxLength(MediaDescriptorConsts.MaxNameLength); b.Property(x => x.MimeType).IsRequired().HasMaxLength(MediaDescriptorConsts.MaxMimeTypeLength); b.Property(x => x.Size).HasMaxLength(MediaDescriptorConsts.MaxSizeLength); diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index be28728596..9bdd1cfb96 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -402,7 +402,7 @@ namespace Volo.CmsKit { using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(_cmsKitTestData.Media_1_Content))) { - var media = new MediaDescriptor(_cmsKitTestData.Media_1_Id, _cmsKitTestData.Media_1_Name, _cmsKitTestData.Media_1_ContentType, stream.Length); + var media = new MediaDescriptor(_cmsKitTestData.Media_1_Id, _cmsKitTestData.Media_1_EntityType, _cmsKitTestData.Media_1_Name, _cmsKitTestData.Media_1_ContentType, stream.Length); await _mediaDescriptorRepository.InsertAsync(media); diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 3762b8b073..32e4cd9f84 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -1,6 +1,7 @@ using System; using JetBrains.Annotations; using Volo.Abp.DependencyInjection; +using Volo.CmsKit.Blogs; namespace Volo.CmsKit { @@ -101,6 +102,8 @@ namespace Volo.CmsKit public Guid Media_1_Id { get; } = Guid.NewGuid(); + public string Media_1_EntityType = nameof(Blog); + public string Media_1_Content = "Hi, this is text file"; public string Media_1_Name = "hello.txt"; From f1ed14797a0e68dc4f65a61ba10e0b1c7a70cb7e Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 09:43:00 +0300 Subject: [PATCH 003/101] added new migration --- ...4229_Added_EntityType_to_Media.Designer.cs | 2012 +++++++++++++++++ ...0210302064229_Added_EntityType_to_Media.cs | 25 + .../UnifiedDbContextModelSnapshot.cs | 5 + 3 files changed, 2042 insertions(+) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.Designer.cs new file mode 100644 index 0000000000..d291705365 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.Designer.cs @@ -0,0 +1,2012 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210302064229_Added_EntityType_to_Media")] + partial class Added_EntityType_to_Media + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + 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.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .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("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + 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/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.cs new file mode 100644 index 0000000000..10a6abd994 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302064229_Added_EntityType_to_Media.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_EntityType_to_Media : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EntityType", + table: "CmsMediaDescriptors", + type: "nvarchar(64)", + maxLength: 64, + nullable: false, + defaultValue: ""); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EntityType", + table: "CmsMediaDescriptors"); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 63c57a4390..cd61c93ff2 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1475,6 +1475,11 @@ namespace Volo.CmsKit.Migrations .HasColumnType("datetime2") .HasColumnName("DeletionTime"); + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + b.Property("ExtraProperties") .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); From f2d3f62a17ddbd72233bf20547a13d76020be2a4 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 11:06:57 +0300 Subject: [PATCH 004/101] CmsKit - Add definitions to MediaDescriptor --- .../Admin/CmsKitAdminApplicationModule.cs | 26 +++++++++++ .../MediaDescriptorAdminAppService.cs | 38 ++++++++++++---- .../CmsKit/CmsKitCommonApplicationModule.cs | 5 +++ .../Volo/CmsKit/CmsKitErrorCodes.cs | 1 + .../CmsKit/Localization/Resources/en.json | 1 + .../CmsKit/Localization/Resources/tr.json | 1 + .../Volo/CmsKit/Pages/PageConsts.cs | 2 + .../MediaDescriptors/CmsKitMediaOptions.cs | 15 +++++++ .../DefaultMediaDescriptorDefinitionStore.cs | 43 +++++++++++++++++++ .../EntityCantHaveMediaException.cs | 21 +++++++++ .../IMediaDescriptorDefinitionStore.cs | 12 ++++++ .../MediaDescriptors/MediaDescriptor.cs | 4 +- .../MediaDescriptorDefinition.cs | 18 ++++++++ .../MediaDescriptorManager.cs | 36 ++++++++++++++++ .../Volo/CmsKit/PolicySpecifiedDefinition.cs | 14 +++++- .../CmsKit/Tags/TagEntityTypeDefiniton.cs | 4 +- 16 files changed, 226 insertions(+), 15 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/CmsKitMediaOptions.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/EntityCantHaveMediaException.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorDefinitionStore.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index 2ad96af963..6da0e9233a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -7,6 +7,8 @@ using Volo.Abp.Modularity; using Volo.CmsKit.Blogs; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Localization; +using Volo.CmsKit.MediaDescriptors; +using Volo.CmsKit.Pages; using Volo.CmsKit.Permissions; using Volo.CmsKit.Tags; @@ -49,6 +51,30 @@ namespace Volo.CmsKit.Admin CmsKitAdminPermissions.BlogPosts.Update)); } }); + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + Configure(options => + { + if (GlobalFeatureManager.Instance.IsEnabled()) + { + options.EntityTypes.AddIfNotContains( + new MediaDescriptorDefinition( + BlogPostConsts.EntityType, + createPolicy: CmsKitAdminPermissions.BlogPosts.Update, + deletePolicy: CmsKitAdminPermissions.BlogPosts.Delete)); + } + + if (GlobalFeatureManager.Instance.IsEnabled()) + { + options.EntityTypes.AddIfNotContains( + new MediaDescriptorDefinition( + PageConsts.EntityType, + createPolicy: CmsKitAdminPermissions.Pages.Update, + deletePolicy: CmsKitAdminPermissions.Pages.Delete)); + } + }); + } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index ee2b5af152..dfa752aeb5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -13,31 +13,51 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [Authorize(CmsKitAdminPermissions.MediaDescriptors.Default)] public class MediaDescriptorAdminAppService : CmsKitAdminAppServiceBase, IMediaDescriptorAdminAppService { - protected readonly IBlobContainer MediaContainer; - protected readonly IMediaDescriptorRepository MediaDescriptorRepository; - - public MediaDescriptorAdminAppService(IBlobContainer mediaContainer, IMediaDescriptorRepository mediaDescriptorRepository) + protected IBlobContainer MediaContainer { get; } + protected IMediaDescriptorRepository MediaDescriptorRepository { get; } + protected MediaDescriptorManager MediaDescriptorManager { get; } + protected IMediaDescriptorDefinitionStore MediaDescriptorDefinitionStore { get; } + + public MediaDescriptorAdminAppService( + IBlobContainer mediaContainer, + IMediaDescriptorRepository mediaDescriptorRepository, + MediaDescriptorManager mediaDescriptorManager, + IMediaDescriptorDefinitionStore mediaDescriptorDefinitionStore) { MediaContainer = mediaContainer; MediaDescriptorRepository = mediaDescriptorRepository; + MediaDescriptorManager = mediaDescriptorManager; + MediaDescriptorDefinitionStore = mediaDescriptorDefinitionStore; } [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task CreateAsync(CreateMediaInputStream inputStream) { + var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(inputStream.EntityType); + + await CheckPolicyAsync(definition.CreatePolicy); + var newId = GuidGenerator.Create(); - var stream = inputStream.GetStream(); - var newEntity = new MediaDescriptor(newId, inputStream.EntityType, inputStream.Name, inputStream.ContentType, stream.Length, CurrentTenant.Id); + using (var stream = inputStream.GetStream()) + { + var newEntity = await MediaDescriptorManager.Create(inputStream.ContentType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); - await MediaContainer.SaveAsync(newId.ToString(), stream); - await MediaDescriptorRepository.InsertAsync(newEntity); + await MediaContainer.SaveAsync(newId.ToString(), stream); + await MediaDescriptorRepository.InsertAsync(newEntity); - return ObjectMapper.Map(newEntity); + return ObjectMapper.Map(newEntity); + } } [Authorize(CmsKitAdminPermissions.MediaDescriptors.Delete)] public virtual async Task DeleteAsync(Guid id) { + var mediaDescriptor = await MediaDescriptorRepository.GetAsync(id); + + var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(mediaDescriptor.EntityType); + + await CheckPolicyAsync(definition.DeletePolicy); + await MediaContainer.DeleteAsync(id.ToString()); await MediaDescriptorRepository.DeleteAsync(id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationModule.cs index 8fa08fa950..1778e7e234 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationModule.cs @@ -1,6 +1,11 @@ using Volo.Abp.Application; using Volo.Abp.AutoMapper; +using Volo.Abp.GlobalFeatures; using Volo.Abp.Modularity; +using Volo.CmsKit.Blogs; +using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.MediaDescriptors; +using Volo.CmsKit.Permissions; namespace Volo.CmsKit { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index 64956b8683..b358672a1a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -28,6 +28,7 @@ public static class MediaDescriptors { public const string InvalidName = "CmsKit:Media:0001"; + public const string EntityTypeDoesntExist = "CmsKit:Media:0002"; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 8102350c6a..1107d5e5db 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -20,6 +20,7 @@ "CmsKit:Media:0001": "'{Name}' is not a valid media name.", "CmsKit:Page:0001": "The given url ({0}) already exists.", "CmsKit:Tag:0002": "The entity is not taggable!", + "CmsKit:Media:0002": "The entity can't have media.", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display.", "CommentDeletionConfirmationMessage": "This comment and all replies will be deleted!", "Comments": "Comments", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 5701c631f2..f41639325a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -16,6 +16,7 @@ "CmsKit:0002": "İçerik zaten mevcut!", "CmsKit:0003": "{0} ögesi etiketlenebilir değil.", "CmsKit:BlogPost:0001": "Aynı url etiketi zaten mevcut.", + "CmsKit:Media:0002": "Bu öge için medya eklenemez.", "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır.", "CmsKit:Tag:0002": "Bu öge etiketlenebilir değil.", "CommentAuthorizationExceptionMessage": "Bu yorumları görebilmek için yetki gerekir.", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs index 47d82b5d07..fc4c5c75ad 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -2,6 +2,8 @@ { public class PageConsts { + public const string EntityType = "Page"; + public static int MaxTitleLength { get; set; } = 256; public static int MaxSlugLength { get; set; } = 256; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/CmsKitMediaOptions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/CmsKitMediaOptions.cs new file mode 100644 index 0000000000..89f5d0dca3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/CmsKitMediaOptions.cs @@ -0,0 +1,15 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class CmsKitMediaOptions + { + [NotNull] + public List EntityTypes { get; } = new(); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs new file mode 100644 index 0000000000..4cf5889dcc --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs @@ -0,0 +1,43 @@ +using JetBrains.Annotations; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.DependencyInjection; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class DefaultMediaDescriptorDefinitionStore : IMediaDescriptorDefinitionStore, ITransientDependency + { + protected CmsKitMediaOptions Options { get; } + + public DefaultMediaDescriptorDefinitionStore(IOptions options) + { + Options = options.Value; + } + + /// + /// Gets single by entityType. + /// + /// EntityType to get definition. + /// Thrown when EntityType is not configured as taggable. + /// More than one element satisfies the condition in predicate. + public Task GetDefinitionAsync([NotNull] string entityType) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + var result = Options.EntityTypes.SingleOrDefault(x => x.EntityType == entityType) ?? + throw new EntityCantHaveMediaException(entityType); + + return Task.FromResult(result); + } + + public Task IsDefinedAsync([NotNull] string entityType) + { + return Task.Run(() => Options.EntityTypes.Any(a => a.EntityType == entityType)); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/EntityCantHaveMediaException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/EntityCantHaveMediaException.cs new file mode 100644 index 0000000000..29d60126a1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/EntityCantHaveMediaException.cs @@ -0,0 +1,21 @@ +using System.Runtime.Serialization; +using Volo.Abp; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class EntityCantHaveMediaException : BusinessException + { + public EntityCantHaveMediaException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) + { + } + + public EntityCantHaveMediaException(string entityType) + { + EntityType = entityType; + Code = CmsKitErrorCodes.MediaDescriptors.EntityTypeDoesntExist; + WithData(nameof(entityType), EntityType); + } + + public string EntityType { get; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorDefinitionStore.cs new file mode 100644 index 0000000000..9cd5c5c40d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/IMediaDescriptorDefinitionStore.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using System.Threading.Tasks; + +namespace Volo.CmsKit.MediaDescriptors +{ + public interface IMediaDescriptorDefinitionStore + { + Task IsDefinedAsync([NotNull] string entityType); + + Task GetDefinitionAsync([NotNull] string entityType); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs index c97eb26b9a..ee0df74b59 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptor.cs @@ -9,7 +9,7 @@ namespace Volo.CmsKit.MediaDescriptors { public Guid? TenantId { get; protected set; } - public string EntityType { get; set; } + public string EntityType { get; protected set; } public string Name { get; protected set; } @@ -22,7 +22,7 @@ namespace Volo.CmsKit.MediaDescriptors } - public MediaDescriptor(Guid id, string entityType, string name, string mimeType, long size, Guid? tenantId = null) : base(id) + internal MediaDescriptor(Guid id, string entityType, string name, string mimeType, long size, Guid? tenantId = null) : base(id) { TenantId = tenantId; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs new file mode 100644 index 0000000000..b2ccb01460 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class MediaDescriptorDefinition : PolicySpecifiedDefinition + { + public MediaDescriptorDefinition( + [NotNull] string entityType, + [CanBeNull] string createPolicy = null, + [CanBeNull] string updatePolicy = null, + [CanBeNull] string deletePolicy = null) : base(entityType, + createPolicy, + updatePolicy, + deletePolicy) + { + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs new file mode 100644 index 0000000000..f0773ad7ff --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Volo.CmsKit.MediaDescriptors; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class MediaDescriptorManager : DomainService + { + protected IMediaDescriptorDefinitionStore MediaDescriptorDefinitionStore { get; } + + public MediaDescriptorManager(IMediaDescriptorDefinitionStore mediaDescriptorDefinitionStore) + { + MediaDescriptorDefinitionStore = mediaDescriptorDefinitionStore; + } + + public virtual async Task Create(string entityType, string name, string mimeType, long size) + { + if(!await MediaDescriptorDefinitionStore.IsDefinedAsync(entityType)) + { + throw new EntityCantHaveMediaException(entityType); + } + + return new MediaDescriptor( + GuidGenerator.Create(), + entityType, + name, + mimeType, + size, + CurrentTenant.Id); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs index 54527621ec..2a5f69b69e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs @@ -1,23 +1,30 @@ using JetBrains.Annotations; +using System; +using Volo.Abp; namespace Volo.CmsKit { - public abstract class PolicySpecifiedDefinition + public abstract class PolicySpecifiedDefinition : IEquatable { protected PolicySpecifiedDefinition() { } public PolicySpecifiedDefinition( + [NotNull] string entityType, [CanBeNull] string createPolicy = null, [CanBeNull] string updatePolicy = null, [CanBeNull] string deletePolicy = null) { + EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType)); CreatePolicy = createPolicy; DeletePolicy = deletePolicy; UpdatePolicy = updatePolicy; } + [NotNull] + public string EntityType { get; set; } + [CanBeNull] public virtual string CreatePolicy { get; set; } @@ -26,5 +33,10 @@ namespace Volo.CmsKit [CanBeNull] public virtual string DeletePolicy { get; set; } + + public bool Equals(PolicySpecifiedDefinition other) + { + return other?.EntityType == EntityType; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs index e714d91c0b..a6fb4cde7a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs @@ -7,8 +7,6 @@ namespace Volo.CmsKit.Tags { public class TagEntityTypeDefiniton : PolicySpecifiedDefinition, IEquatable { - public string EntityType { get; } - [CanBeNull] public virtual ILocalizableString DisplayName { get; } @@ -21,7 +19,7 @@ namespace Volo.CmsKit.Tags [CanBeNull] ILocalizableString displayName = null, [CanBeNull] string createPolicy = null, [CanBeNull] string updatePolicy = null, - [CanBeNull] string deletePolicy = null) : base(createPolicy, updatePolicy, deletePolicy) + [CanBeNull] string deletePolicy = null) : base(entityType, createPolicy, updatePolicy, deletePolicy) { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); DisplayName = displayName; From 58298bffe66da62659b535097270b7f7dd9c804e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 2 Mar 2021 11:09:36 +0300 Subject: [PATCH 005/101] Cli: fix solution renaming for microservice service template --- .../ProjectBuilding/Building/Steps/SolutionRenameStep.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs index 27199f6ce4..1ea30fe783 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs @@ -18,6 +18,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps context.BuildArgs.SolutionName.CompanyName, context.BuildArgs.SolutionName.ProjectName ).Run(); + + new SolutionRenamer( + context.Files, + null, + "MyProjectName", + null, + SolutionName.Parse(context.BuildArgs.SolutionName.CompanyName).ProjectName + ).Run(); } else { From 6c356a828829f2ece413516bf4df1f86046d8799 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 11:48:42 +0300 Subject: [PATCH 006/101] Added content property to BlogPost and ui --- ...5529_Added_Content_To_BlogPost.Designer.cs | 2016 +++++++++++++++++ ...0210302075529_Added_Content_To_BlogPost.cs | 24 + .../UnifiedDbContextModelSnapshot.cs | 4 + .../Volo/CmsKit/Admin/Blogs/BlogPostDto.cs | 5 +- .../CmsKit/Admin/Blogs/CreateBlogPostDto.cs | 3 + .../CmsKit/Admin/Blogs/UpdateBlogPostDto.cs | 4 +- .../Admin/Blogs/BlogPostAdminAppService.cs | 5 +- .../Pages/CmsKit/BlogPosts/Create.cshtml | 28 +- .../Pages/CmsKit/BlogPosts/Create.cshtml.cs | 4 + .../Pages/CmsKit/BlogPosts/Update.cshtml | 29 +- .../Pages/CmsKit/BlogPosts/Update.cshtml.cs | 4 + .../Pages/CmsKit/BlogPosts/create.js | 109 +- .../Pages/CmsKit/BlogPosts/update.js | 132 +- .../Volo/CmsKit/Blogs/BlogPostConsts.cs | 2 + .../Volo/CmsKit/Blogs/BlogPost.cs | 16 +- .../Volo/CmsKit/Blogs/BlogPostManager.cs | 6 +- .../CmsKitDbContextModelCreatingExtensions.cs | 8 +- .../CmsKit/Public/Blogs/BlogPostPublicDto.cs | 2 + .../Components/Blogs/BlogPost/Default.cshtml | 6 +- .../Blogs/BlogPostAdminAppService_Tests.cs | 14 +- .../CmsKitDataSeedContributor.cs | 6 +- 21 files changed, 2318 insertions(+), 109 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.Designer.cs new file mode 100644 index 0000000000..8f6bd9239d --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.Designer.cs @@ -0,0 +1,2016 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210302075529_Added_Content_To_BlogPost")] + partial class Added_Content_To_BlogPost + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + 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.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .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("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + 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/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.cs new file mode 100644 index 0000000000..836507c222 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302075529_Added_Content_To_BlogPost.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Content_To_BlogPost : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Content", + table: "CmsBlogPosts", + type: "nvarchar(max)", + maxLength: 2147483647, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Content", + table: "CmsBlogPosts"); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index cd61c93ff2..e3e9f4cc68 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1269,6 +1269,10 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs index d12a2f2982..5222b50fe8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs @@ -11,6 +11,9 @@ namespace Volo.CmsKit.Admin.Blogs public string Title { get; set; } public string Slug { get; set; } - public string ShortDescription { get; protected set; } + + public string ShortDescription { get; set; } + + public string Content { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs index 7780a21669..3e339c738c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs @@ -21,5 +21,8 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] public string ShortDescription { get; set; } + + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] + public string Content { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs index eeb4548c8e..7aaf775427 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs @@ -18,6 +18,8 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] public string ShortDescription { get; set; } - + + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] + public string Content { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 4fbbf88675..a25aa07a09 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -54,7 +54,7 @@ namespace Volo.CmsKit.Admin.Blogs input.Title, input.Slug, input.ShortDescription, - CurrentTenant.Id); + input.Content); await BlogPostRepository.InsertAsync(blogPost); @@ -68,7 +68,8 @@ namespace Volo.CmsKit.Admin.Blogs blogPost.SetTitle(input.Title); blogPost.SetShortDescription(input.ShortDescription); - + blogPost.SetContent(input.Content); + if (blogPost.Slug != input.Slug) { await BlogPostManager.SetSlugUrlAsync(blogPost, input.Slug); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml index ae5c3ce9bd..8440bc0c40 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml @@ -1,5 +1,7 @@ @page +@using System.Globalization +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor @using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar @using Volo.CmsKit.Admin.Web.Pages @@ -22,12 +24,19 @@ @section scripts { - - - + + + + } +@section styles { + + + +} + @section content_toolbar { @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(CreateModel).FullName }) } @@ -50,15 +59,14 @@ - - @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new - { - entityType = BlogPostConsts.EntityType, - displaySubmitButton = false - }) - + +
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs index 2d01e55668..2d3c7d36ab 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs @@ -58,6 +58,10 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] public string ShortDescription { get; set; } + + [HiddenInput] + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] + public string Content { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml index b4692365ef..b9a1dbb638 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml @@ -1,5 +1,7 @@ @page "{Id}" +@using System.Globalization +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor @using Volo.CmsKit.Blogs @using Volo.CmsKit.Admin.Web.Pages @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar @@ -22,12 +24,19 @@ @section scripts { - - - + + + + } +@section styles { + + + +} + @section content_toolbar { @await Component.InvokeAsync(typeof(AbpPageToolbarViewComponent), new { pageName = typeof(UpdateModel).FullName }) } @@ -49,14 +58,14 @@ - @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new - { - entityType = BlogPostConsts.EntityType, - entityId = Model.Id.ToString(), - displaySubmitButton = false - }) - + +
+
+ @if (Model.TagsFeature?.IsEnabled == true) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs index 29c839a947..5fef40f8a1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs @@ -72,6 +72,10 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxShortDescriptionLength))] [DisplayOrder(10001)] public string ShortDescription { get; set; } + + [HiddenInput] + [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] + public string Content { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index b2fd0613e6..e1e132e2a0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -41,7 +41,12 @@ $formCreate.ajaxSubmit({ success: function (result) { - submitEntityContent(result.id); + if (isTagsEnabled) { + submitEntityTags(result.id); + } + else { + submitCoverImage(result.id); + } }, error: function (result) { abp.notify.error(result.responseJSON.error.message); @@ -55,29 +60,16 @@ e.preventDefault(); $formCreate.submit(); }); - - function submitEntityContent(blogPostId) { - volo.cmsKit.admin.contents.contentAdmin - .create( - { - entityType: 'BlogPost', - entityId: blogPostId, - value: $pageContentInput.val() - }) - .then(function (result) { - if (isTagsEnabled) { - submitEntityTags(blogPostId) - } - else { - submitCoverImage(blogPostId); - } - }); - } - + function submitEntityTags(blogPostId) { - var tags = $tagsInput.val().split(","); - + var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); + + if(tags.length === 0){ + submitCoverImage(blogPostId); + return; + } + volo.cmsKit.admin.tags.entityTagAdmin .setEntityTags({ entityType: 'BlogPost', @@ -209,4 +201,77 @@ } }); }); + + // ----------------------------------- + var fileUploadUri = "/api/cms-kit-admin/media/blogpost"; + var fileUriPrefix = "/api/cms-kit/media/"; + + var editorDataKey = "tuiEditor"; + + initAllEditors(); + + function initAllEditors() { + $('.content-editor').each(function (i, item) { + initEditor(item); + }); + } + + function initEditor(element) { + var $editorContainer = $(element); + var inputName = $editorContainer.data('input-id'); + var $editorInput = $('#' + inputName); + var initialValue = $editorInput.val(); + + var editor = $editorContainer.tuiEditor({ + usageStatistics: false, + useCommandShortcut: true, + initialValue: initialValue, + previewStyle: 'tab', + height: "25em", + minHeight: "25em", + initialEditType: initialValue ? 'wysiwyg' : 'markdown', + language: $editorContainer.data("language"), + hooks: { + addImageBlobHook: uploadFile, + }, + events: { + change: function (_val) { + $editorInput.val(editor.getHtml()); + $editorInput.trigger("change"); + } + } + }).data(editorDataKey); + } + + function uploadFile(blob, callback, source) { + var UPPY_OPTIONS = { + endpoint: fileUploadUri, + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + UPPY.addFile({ + id: "content-file", + name: blob.name, + type: blob.type, + data: blob, + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error("File upload failed"); + } else { + var mediaDto = result.successful[0].response.body; + var fileUrl = (fileUriPrefix + mediaDto.id); + + callback(fileUrl, mediaDto.name); + } + }); + } }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 9a2fb3c69a..14bfdc6f55 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -8,15 +8,15 @@ var $titleClone = $('#title-clone'); var $slug = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-update'); - var $contentValueInput = $('#ViewModel_Value'); var $blogPostIdInput = $('#Id'); - var $contentIdInput = $('#ViewModel_Id'); var $tagsInput = $('.tag-editor-form input[name=tags]'); var $fileInput = $('#BlogPostCoverImage'); var UPPY_UPLOAD_ENDPOINT = "/api/cms-kit-admin/blogs/blog-posts/{0}/cover-image"; var UPPY_FILE_ID = "uppy-upload-file"; + var isTagsEnabled = true; + $formUpdate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; function initSelectBlog() { @@ -40,7 +40,12 @@ $formUpdate.ajaxSubmit({ success: function (result) { - submitEntityContent(); + if (isTagsEnabled) { + submitEntityTags($blogPostIdInput.val()); + } + else { + submitCoverImage($blogPostIdInput.val()); + } }, error: function (result) { abp.ui.clearBusy(); abp.notify.error(result.responseJSON.error.message); @@ -53,49 +58,16 @@ e.preventDefault(); $formUpdate.submit(); }); + + function submitEntityTags(blogPostId) { - function submitEntityContent() { - - var contentId = $contentIdInput.val(); - var blogPostId = $blogPostIdInput.val(); - var contentValue = $contentValueInput.val(); - - if (contentId) { - volo.cmsKit.admin.contents.contentAdmin - .update(contentId, - { - value: contentValue - }) - .then(function (result) { - entityContentCallback(blogPostId); - }); - } - else { - volo.cmsKit.admin.contents.contentAdmin - .create({ - entityType: 'BlogPost', - entityId: blogPostId, - value: contentValue - }) - .then(function (result) { - entityContentCallback(blogPostId); - }); - } - } + var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); - function entityContentCallback(blogPostId) { - if ($tagsInput.val()) { - submitEntityTags(blogPostId); - } - else { + if(tags.length === 0){ submitCoverImage(blogPostId); + return; } - } - - function submitEntityTags(blogPostId) { - - var tags = $tagsInput.val().split(","); - + volo.cmsKit.admin.tags.entityTagAdmin .setEntityTags({ entityType: 'BlogPost', @@ -154,7 +126,7 @@ function finishSaving(result) { abp.notify.success(l('SuccessfullySaved')); abp.ui.clearBusy(); - location.href = "../BlogPosts/"; + location.href = "/CmsKit/BlogPosts/"; } $titleClone.on('change paste keyup', function () { @@ -177,4 +149,78 @@ }); } } + + + // ----------------------------------- + var fileUploadUri = "/api/cms-kit-admin/media/blogpost"; + var fileUriPrefix = "/api/cms-kit/media/"; + + var editorDataKey = "tuiEditor"; + + initAllEditors(); + + function initAllEditors() { + $('.content-editor').each(function (i, item) { + initEditor(item); + }); + } + + function initEditor(element) { + var $editorContainer = $(element); + var inputName = $editorContainer.data('input-id'); + var $editorInput = $('#' + inputName); + var initialValue = $editorInput.val(); + + var editor = $editorContainer.tuiEditor({ + usageStatistics: false, + useCommandShortcut: true, + initialValue: initialValue, + previewStyle: 'tab', + height: "25em", + minHeight: "25em", + initialEditType: initialValue ? 'wysiwyg' : 'markdown', + language: $editorContainer.data("language"), + hooks: { + addImageBlobHook: uploadFile, + }, + events: { + change: function (_val) { + $editorInput.val(editor.getHtml()); + $editorInput.trigger("change"); + } + } + }).data(editorDataKey); + } + + function uploadFile(blob, callback, source) { + var UPPY_OPTIONS = { + endpoint: fileUploadUri, + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + UPPY.addFile({ + id: "content-file", + name: blob.name, + type: blob.type, + data: blob, + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error("File upload failed"); + } else { + var mediaDto = result.successful[0].response.body; + var fileUrl = (fileUriPrefix + mediaDto.id); + + callback(fileUrl, mediaDto.name); + } + }); + } }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs index 7e1de6e7c0..91748dc1e3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs @@ -11,6 +11,8 @@ namespace Volo.CmsKit.Blogs public static int MinSlugLength { get; set; } = 2; public static int MaxShortDescriptionLength { get; set; } = 256; + + public static int MaxContentLength { get; set; } = int.MaxValue; public const string EntityType = "BlogPost"; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs index dc10725359..251a9c2895 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs @@ -21,9 +21,10 @@ namespace Volo.CmsKit.Blogs [NotNull] public virtual string ShortDescription { get; protected set; } + public virtual string Content { get; protected set; } + public virtual Guid? TenantId { get; protected set; } - [NotNull] public Guid AuthorId { get; set; } public virtual CmsUser Author { get; set; } @@ -38,13 +39,17 @@ namespace Volo.CmsKit.Blogs Guid authorId, [NotNull] string title, [NotNull] string slug, - [CanBeNull] string shortDescription = null) : base(id) + [CanBeNull] string shortDescription = null, + [CanBeNull] string content = null, + [CanBeNull] Guid? tenantId = null) : base(id) { + TenantId = tenantId; BlogId = blogId; AuthorId = authorId; SetTitle(title); SetSlug(slug); - ShortDescription = shortDescription; + SetShortDescription(shortDescription); + SetContent(content); } public virtual void SetTitle(string title) @@ -63,5 +68,10 @@ namespace Volo.CmsKit.Blogs { ShortDescription = Check.Length(shortDescription, nameof(shortDescription), BlogPostConsts.MaxShortDescriptionLength); } + + public virtual void SetContent(string content) + { + Content = Check.Length(content, nameof(content), BlogPostConsts.MaxContentLength); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs index 4ee29608b4..3e15b91117 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs @@ -27,7 +27,7 @@ namespace Volo.CmsKit.Blogs [NotNull] string title, [NotNull] string slug, [CanBeNull] string shortDescription = null, - [CanBeNull] Guid? tenantId = null) + [CanBeNull] string content = null) { Check.NotNull(author, nameof(author)); Check.NotNull(blog, nameof(blog)); @@ -42,7 +42,9 @@ namespace Volo.CmsKit.Blogs author.Id, title, slug, - shortDescription + shortDescription, + content, + CurrentTenant.Id ); await CheckSlugExistenceAsync(blog.Id, blogPost.Slug); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 476e2a3111..8208dd38ea 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -207,14 +207,12 @@ namespace Volo.CmsKit.EntityFrameworkCore b.ConfigureByConvention(); + b.Property(p => p.AuthorId).IsRequired(); b.Property(p => p.Title).IsRequired().HasMaxLength(BlogPostConsts.MaxTitleLength); - b.Property(p => p.Slug).IsRequired().HasMaxLength(BlogPostConsts.MaxSlugLength); - b.Property(p => p.ShortDescription).HasMaxLength(BlogPostConsts.MaxShortDescriptionLength); - - b.Property(p => p.AuthorId).IsRequired(); - + b.Property(p => p.Content).HasMaxLength(BlogPostConsts.MaxContentLength); + b.HasIndex(x => new { x.Slug, x.BlogId }); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs index ece2704513..a7358f176a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs @@ -15,6 +15,8 @@ namespace Volo.CmsKit.Public.Blogs public string ShortDescription { get; set; } + public string Content { get; set; } + public CmsUserDto Author { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml index 39737ba8df..76d1487861 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -14,11 +14,7 @@ - @await Component.InvokeAsync(typeof(ContentViewComponent), new - { - entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, - entityId = Model.Id.ToString() - }) + @Html.Raw(Model.Content) @Model.CreationTime diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs index 4fe6f2e23e..28e3daea8d 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs @@ -30,13 +30,15 @@ namespace Volo.CmsKit.Blogs var title = "My awesome new Post"; var slug = "my-awesome-new-post"; var shortDescription = "This blog is all about awesomeness 🤗!"; - + var content = "Another blog post shared on internet"; + var created = await blogPostAdminAppService.CreateAsync(new CreateBlogPostDto { BlogId = cmsKitTestData.Blog_Id, Title = title, Slug = slug, - ShortDescription = shortDescription + ShortDescription = shortDescription, + Content = content }); created.Id.ShouldNotBe(Guid.Empty); @@ -46,6 +48,7 @@ namespace Volo.CmsKit.Blogs blogPost.Title.ShouldBe(title); blogPost.Slug.ShouldBe(slug); blogPost.ShortDescription.ShouldBe(shortDescription); + blogPost.Content.ShouldBe(content); } [Fact] @@ -54,6 +57,7 @@ namespace Volo.CmsKit.Blogs var title = "Another My Awesome New Post"; var slug = "another-my-awesome-new-post"; var shortDescription = "This blog is all about awesomeness 🤗!"; + var content = "Another blog post shared on internet"; var dto = new CreateBlogPostDto { @@ -61,7 +65,8 @@ namespace Volo.CmsKit.Blogs BlogId = Guid.NewGuid(), Title = title, Slug = slug, - ShortDescription = shortDescription + ShortDescription = shortDescription, + Content = content }; var exception = await Should.ThrowAsync(async () => @@ -107,12 +112,14 @@ namespace Volo.CmsKit.Blogs var shortDescription = "Another short description"; var title = "[Solved] Another Blog Post"; var slug = "another-short-blog-post"; + var content = "Another blog post shared on internet"; await blogPostAdminAppService.UpdateAsync(cmsKitTestData.BlogPost_2_Id, new UpdateBlogPostDto { ShortDescription = shortDescription, Title = title, Slug = slug, + Content = content }); var blogPost = await blogPostRepository.GetAsync(cmsKitTestData.BlogPost_2_Id); @@ -120,6 +127,7 @@ namespace Volo.CmsKit.Blogs blogPost.Title.ShouldBe(title); blogPost.ShortDescription.ShouldBe(shortDescription); blogPost.Slug.ShouldBe(slug); + blogPost.Content.ShouldBe(content); } [Fact] diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 9bdd1cfb96..00969c46ab 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -367,7 +367,8 @@ namespace Volo.CmsKit blog, _cmsKitTestData.BlogPost_1_Title, _cmsKitTestData.BlogPost_1_Slug, - "Short desc 1"))).Id; + "Short desc 1", + "Blog Post 1 Content"))).Id; _cmsKitTestData.BlogPost_2_Id = (await _blogPostRepository.InsertAsync( @@ -376,7 +377,8 @@ namespace Volo.CmsKit blog, _cmsKitTestData.BlogPost_2_Title, _cmsKitTestData.BlogPost_2_Slug, - "Short desc 2"))).Id; + "Short desc 2", + "Blog Post 2 Content"))).Id; } private async Task SeedBlogFeaturesAsync() From 39b449569aedb700e7dfc8f3cb9efcd9faf97c0a Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 12:19:11 +0300 Subject: [PATCH 007/101] CmsKit - Update tests for MediaDescriptor --- .../MediaDescriptorAdminAppService.cs | 2 +- .../Volo/CmsKit/AssemblyInfo.cs | 4 ++ .../DefaultMediaDescriptorDefinitionStore.cs | 6 ++- .../MediaDescriptorDefinition.cs | 8 +++- .../MediaDescriptorManager.cs | 9 +--- .../MediaDescriptorAdminAppService_Tests.cs | 3 +- .../MediaDescriptorManager_Test.cs | 44 +++++++++++++++++++ .../CmsKitDataSeedContributor.cs | 7 ++- .../Volo.CmsKit.TestBase/CmsKitTestData.cs | 12 ++--- 9 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/AssemblyInfo.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.Domain.Tests/MediaDescriptors/MediaDescriptorManager_Test.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index dfa752aeb5..5307591447 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -40,7 +40,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors var newId = GuidGenerator.Create(); using (var stream = inputStream.GetStream()) { - var newEntity = await MediaDescriptorManager.Create(inputStream.ContentType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); + var newEntity = await MediaDescriptorManager.CreateAsync(inputStream.EntityType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); await MediaContainer.SaveAsync(newId.ToString(), stream); await MediaDescriptorRepository.InsertAsync(newEntity); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/AssemblyInfo.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/AssemblyInfo.cs new file mode 100644 index 0000000000..f8d4fc09f3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Volo.CmsKit.Domain.Tests", AllInternalsVisible = true)] +[assembly: InternalsVisibleTo("Volo.CmsKit.TestBase", AllInternalsVisible = true)] \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs index 4cf5889dcc..4bdd4d6e98 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs @@ -37,7 +37,11 @@ namespace Volo.CmsKit.MediaDescriptors public Task IsDefinedAsync([NotNull] string entityType) { - return Task.Run(() => Options.EntityTypes.Any(a => a.EntityType == entityType)); + Check.NotNullOrEmpty(entityType, nameof(entityType)); + + var isDefined = Options.EntityTypes.Any(a => a.EntityType == entityType); + + return Task.FromResult(isDefined); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs index b2ccb01460..073ed694f6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs @@ -1,8 +1,9 @@ using JetBrains.Annotations; +using System; namespace Volo.CmsKit.MediaDescriptors { - public class MediaDescriptorDefinition : PolicySpecifiedDefinition + public class MediaDescriptorDefinition : PolicySpecifiedDefinition, IEquatable { public MediaDescriptorDefinition( [NotNull] string entityType, @@ -14,5 +15,10 @@ namespace Volo.CmsKit.MediaDescriptors deletePolicy) { } + + public bool Equals(MediaDescriptorDefinition other) + { + return base.Equals(other); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs index f0773ad7ff..730e4e3ccf 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorManager.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Volo.Abp.Domain.Services; -using Volo.CmsKit.MediaDescriptors; namespace Volo.CmsKit.MediaDescriptors { @@ -17,7 +12,7 @@ namespace Volo.CmsKit.MediaDescriptors MediaDescriptorDefinitionStore = mediaDescriptorDefinitionStore; } - public virtual async Task Create(string entityType, string name, string mimeType, long size) + public virtual async Task CreateAsync(string entityType, string name, string mimeType, long size) { if(!await MediaDescriptorDefinitionStore.IsDefinedAsync(entityType)) { diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs index 20bfaf2c12..52169eddbe 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/MediaDescriptors/MediaDescriptorAdminAppService_Tests.cs @@ -34,7 +34,8 @@ namespace Volo.CmsKit.MediaDescriptors var inputStream = new CreateMediaInputStream(stream) { ContentType = mediaType, - Name = mediaName + Name = mediaName, + EntityType = _cmsKitTestData.Media_1_EntityType }; var media = await _mediaDescriptorAdminAppService.CreateAsync(inputStream); diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/MediaDescriptors/MediaDescriptorManager_Test.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/MediaDescriptors/MediaDescriptorManager_Test.cs new file mode 100644 index 0000000000..6bf183564e --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/MediaDescriptors/MediaDescriptorManager_Test.cs @@ -0,0 +1,44 @@ +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Blogs; +using Xunit; + +namespace Volo.CmsKit.MediaDescriptors +{ + public class MediaDescriptorManager_Test : CmsKitDomainTestBase + { + private readonly MediaDescriptorManager manager; + private readonly CmsKitTestData testData; + + public MediaDescriptorManager_Test() + { + manager = GetRequiredService(); + testData = GetRequiredService(); + } + + [Fact] + public async Task CreateAsync_ShouldWorkProperly_WithDefinedEntityType() + { + var created = await manager.CreateAsync(testData.Media_1_EntityType, "MyAwesomeImage.png", "image/png", 128000); + + created.ShouldNotBeNull(); + created.Id.ShouldNotBe(Guid.Empty); + } + + [Fact] + public async Task CreateAsync_ShouldThrowException_WithUndefinedEntityType() + { + var undefinedEntityType = "My.Any.EntityType"; + + var exception = await Should.ThrowAsync(async () => + await manager.CreateAsync(undefinedEntityType, "import.json", "application/json", 256000)); + + exception.ShouldNotBeNull(); + exception.EntityType.ShouldBe(undefinedEntityType); + } + } +} diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 9bdd1cfb96..e2c928be2a 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -48,6 +48,7 @@ namespace Volo.CmsKit private readonly IMediaDescriptorRepository _mediaDescriptorRepository; private readonly IBlobContainer _mediaBlobContainer; private readonly BlogManager _blogManager; + private readonly IOptions _mediaOptions; public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, @@ -71,7 +72,8 @@ namespace Volo.CmsKit IOptions tagOptions, IMediaDescriptorRepository mediaDescriptorRepository, IBlobContainer mediaBlobContainer, - BlogManager blogManager) + BlogManager blogManager, + IOptions cmsMediaOptions) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -95,6 +97,7 @@ namespace Volo.CmsKit _mediaDescriptorRepository = mediaDescriptorRepository; _mediaBlobContainer = mediaBlobContainer; _blogManager = blogManager; + _mediaOptions = cmsMediaOptions; } public async Task SeedAsync(DataSeedContext context) @@ -133,6 +136,8 @@ namespace Volo.CmsKit _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.Content_2_EntityType)); _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.TagDefinition_1_EntityType)); + _mediaOptions.Value.EntityTypes.AddIfNotContains(new MediaDescriptorDefinition(_cmsKitTestData.Media_1_EntityType)); + return Task.CompletedTask; } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 32e4cd9f84..396ae5a013 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -101,13 +101,13 @@ namespace Volo.CmsKit public bool BlogFeature_2_Enabled => false; public Guid Media_1_Id { get; } = Guid.NewGuid(); - - public string Media_1_EntityType = nameof(Blog); - - public string Media_1_Content = "Hi, this is text file"; - public string Media_1_Name = "hello.txt"; + public string Media_1_EntityType => nameof(Blog); - public string Media_1_ContentType = "text/plain"; + public string Media_1_Content { get; } = "Hi, this is text file"; + + public string Media_1_Name { get; } = "hello.txt"; + + public string Media_1_ContentType { get; } = "text/plain"; } } From db84676bfd10f5b33541e2fe86844401efcb9950 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 13:10:31 +0300 Subject: [PATCH 008/101] CmsKit - Change policies of PolicySpecifiedDefinition to collection --- .../Permissions/CmsKitAdminPermissions.cs | 8 ++-- .../CmsKit/Admin/CmsKitAdminAppServiceBase.cs | 35 ++++++++++++++++- .../Admin/CmsKitAdminApplicationModule.cs | 16 ++++---- .../MediaDescriptorAdminAppService.cs | 4 +- .../Admin/Tags/EntityTagAdminAppService.cs | 6 +-- .../MediaDescriptorDefinition.cs | 20 ++++------ .../Volo/CmsKit/PolicySpecifiedDefinition.cs | 38 +++++++++++++------ .../CmsKit/Tags/TagEntityTypeDefiniton.cs | 9 +++-- ...TagEntityTypeDefinitionDictionary_Tests.cs | 8 ++-- 9 files changed, 94 insertions(+), 50 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs index 6de7bad5e4..baa26b0fff 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs @@ -5,13 +5,13 @@ namespace Volo.CmsKit.Permissions public class CmsKitAdminPermissions { public const string GroupName = "CmsKit"; - + public static class Comments { public const string Default = GroupName + ".Comments"; public const string Delete = Default + ".Delete"; } - + public static class Tags { public const string Default = GroupName + ".Tags"; @@ -19,7 +19,7 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } - + public static class Contents { public const string Default = GroupName + ".Contents"; @@ -52,7 +52,7 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } - + public static class MediaDescriptors { public const string Default = GroupName + ".MediaDescriptors"; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs index 3f4596f586..83d36431c8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs @@ -1,4 +1,13 @@ -namespace Volo.CmsKit.Admin +using JetBrains.Annotations; +using Microsoft.AspNetCore.Authorization; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices.ComTypes; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Authorization; + +namespace Volo.CmsKit.Admin { public abstract class CmsKitAdminAppServiceBase : CmsKitAppServiceBase { @@ -6,5 +15,29 @@ { ObjectMapperContext = typeof(CmsKitAdminApplicationModule); } + + /// + /// Checks given policies until finding granted policy. If none of them is granted, throws + /// + /// Policies to be checked. + /// Thrown when none of policies is granted. + protected async Task CheckAnyOfPoliciesAsync([NotNull] IEnumerable policies) + { + Check.NotNull(policies, nameof(policies)); + + foreach (var policy in policies) + { + if (await AuthorizationService.IsGrantedAsync(policy)) + { + return; + } + } + + var exception = new AbpAuthorizationException(); + + exception.Data[nameof(policies)] = policies; + + throw exception; + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index 6da0e9233a..95dbe44a04 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -46,9 +46,9 @@ namespace Volo.CmsKit.Admin new TagEntityTypeDefiniton( BlogPostConsts.EntityType, LocalizableString.Create("BlogPost"), - CmsKitAdminPermissions.BlogPosts.Update, - CmsKitAdminPermissions.BlogPosts.Update, - CmsKitAdminPermissions.BlogPosts.Update)); + new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, + new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, + new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update })); } }); @@ -60,9 +60,9 @@ namespace Volo.CmsKit.Admin { options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( - BlogPostConsts.EntityType, - createPolicy: CmsKitAdminPermissions.BlogPosts.Update, - deletePolicy: CmsKitAdminPermissions.BlogPosts.Delete)); + BlogPostConsts.EntityType, + createPolicies: new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, + deletePolicies: new[] { CmsKitAdminPermissions.BlogPosts.Delete })); } if (GlobalFeatureManager.Instance.IsEnabled()) @@ -70,8 +70,8 @@ namespace Volo.CmsKit.Admin options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( PageConsts.EntityType, - createPolicy: CmsKitAdminPermissions.Pages.Update, - deletePolicy: CmsKitAdminPermissions.Pages.Delete)); + createPolicies: new[] { CmsKitAdminPermissions.Pages.Create, CmsKitAdminPermissions.Pages.Update }, + deletePolicies: new[] { CmsKitAdminPermissions.Pages.Delete })); } }); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 5307591447..ba2b1a70b5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -35,7 +35,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(inputStream.EntityType); - await CheckPolicyAsync(definition.CreatePolicy); + await CheckAnyOfPoliciesAsync(definition.CreatePolicies); var newId = GuidGenerator.Create(); using (var stream = inputStream.GetStream()) @@ -56,7 +56,7 @@ namespace Volo.CmsKit.Admin.MediaDescriptors var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(mediaDescriptor.EntityType); - await CheckPolicyAsync(definition.DeletePolicy); + await CheckAnyOfPoliciesAsync(definition.DeletePolicies); await MediaContainer.DeleteAsync(id.ToString()); await MediaDescriptorRepository.DeleteAsync(id); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs index cf3de19933..d118ddece7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/EntityTagAdminAppService.cs @@ -31,7 +31,7 @@ namespace Volo.CmsKit.Admin.Tags { var definition = await TagDefinitionStore.GetTagEntityTypeDefinitionAsync(input.EntityType); - await CheckPolicyAsync(definition.CreatePolicy); + await CheckAnyOfPoliciesAsync(definition.CreatePolicies); var tag = await TagManager.GetOrAddAsync(input.EntityType, input.TagName); @@ -46,7 +46,7 @@ namespace Volo.CmsKit.Admin.Tags { var definition = await TagDefinitionStore.GetTagEntityTypeDefinitionAsync(input.EntityType); - await CheckPolicyAsync(definition.DeletePolicy); + await CheckAnyOfPoliciesAsync(definition.DeletePolicies); await EntityTagManager.RemoveTagFromEntityAsync( input.TagId, @@ -59,7 +59,7 @@ namespace Volo.CmsKit.Admin.Tags { var definition = await TagDefinitionStore.GetTagEntityTypeDefinitionAsync(input.EntityType); - await CheckPolicyAsync(definition.UpdatePolicy); + await CheckAnyOfPoliciesAsync(definition.UpdatePolicies); await EntityTagManager.SetEntityTagsAsync(input.EntityType, input.EntityId, input.Tags); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs index 073ed694f6..95bfaacb61 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/MediaDescriptorDefinition.cs @@ -1,24 +1,20 @@ using JetBrains.Annotations; using System; +using System.Collections.Generic; namespace Volo.CmsKit.MediaDescriptors { - public class MediaDescriptorDefinition : PolicySpecifiedDefinition, IEquatable + public class MediaDescriptorDefinition : PolicySpecifiedDefinition { public MediaDescriptorDefinition( [NotNull] string entityType, - [CanBeNull] string createPolicy = null, - [CanBeNull] string updatePolicy = null, - [CanBeNull] string deletePolicy = null) : base(entityType, - createPolicy, - updatePolicy, - deletePolicy) + IEnumerable createPolicies = null, + IEnumerable updatePolicies = null, + IEnumerable deletePolicies = null) : base(entityType, + createPolicies, + updatePolicies, + deletePolicies) { } - - public bool Equals(MediaDescriptorDefinition other) - { - return base.Equals(other); - } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs index 2a5f69b69e..edfee13337 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/PolicySpecifiedDefinition.cs @@ -1,5 +1,7 @@ using JetBrains.Annotations; using System; +using System.Collections.Generic; +using System.Linq; using Volo.Abp; namespace Volo.CmsKit @@ -12,27 +14,39 @@ namespace Volo.CmsKit public PolicySpecifiedDefinition( [NotNull] string entityType, - [CanBeNull] string createPolicy = null, - [CanBeNull] string updatePolicy = null, - [CanBeNull] string deletePolicy = null) + IEnumerable createPolicies = null, + IEnumerable updatePolicies = null, + IEnumerable deletePolicies = null) { EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType)); - CreatePolicy = createPolicy; - DeletePolicy = deletePolicy; - UpdatePolicy = updatePolicy; + + if (createPolicies != null) + { + CreatePolicies = CreatePolicies.Concat(createPolicies).ToList(); + } + + if (updatePolicies != null) + { + UpdatePolicies = UpdatePolicies.Concat(updatePolicies).ToList(); + } + + if (deletePolicies != null) + { + DeletePolicies = DeletePolicies.Concat(deletePolicies).ToList(); + } } [NotNull] public string EntityType { get; set; } - [CanBeNull] - public virtual string CreatePolicy { get; set; } + [NotNull] + public virtual ICollection CreatePolicies { get; } = new List(); - [CanBeNull] - public virtual string UpdatePolicy { get; set; } + [NotNull] + public virtual ICollection UpdatePolicies { get; } = new List(); - [CanBeNull] - public virtual string DeletePolicy { get; set; } + [NotNull] + public virtual ICollection DeletePolicies { get; } = new List(); public bool Equals(PolicySpecifiedDefinition other) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs index a6fb4cde7a..6dedb1410e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagEntityTypeDefiniton.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using System; +using System.Collections.Generic; using Volo.Abp; using Volo.Abp.Localization; @@ -17,12 +18,12 @@ namespace Volo.CmsKit.Tags public TagEntityTypeDefiniton( [NotNull] string entityType, [CanBeNull] ILocalizableString displayName = null, - [CanBeNull] string createPolicy = null, - [CanBeNull] string updatePolicy = null, - [CanBeNull] string deletePolicy = null) : base(entityType, createPolicy, updatePolicy, deletePolicy) + IEnumerable createPolicies = null, + IEnumerable updatePolicies = null, + IEnumerable deletePolicies = null) : base(entityType, createPolicies, updatePolicies, deletePolicies) { - EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); DisplayName = displayName; + } public bool Equals(TagEntityTypeDefiniton other) diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs index a405c27190..2f2013cd0b 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagEntityTypeDefinitionDictionary_Tests.cs @@ -42,11 +42,11 @@ namespace Volo.CmsKit.Tags { cmsKitTagOptions.EntityTypes.Add( new TagEntityTypeDefiniton( - "My.Entity.Type", + "My.Entity.Type", LocalizableString.Create("MyEntity"), - "SomeCreatePolicy", - "SomeUpdatePolicy", - "SomeDeletePolicy" + new[] { "SomeCreatePolicy" }, + new[] { "SomeUpdatePolicy" }, + new[] { "SomeDeletePolicy" } )); } From e6ffc14c2b4591d609d322d79bcbf74b5ea05a88 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 13:16:55 +0300 Subject: [PATCH 009/101] Added content property to page & update ui --- ...02091451_Added_Content_To_Page.Designer.cs | 2020 +++++++++++++++++ .../20210302091451_Added_Content_To_Page.cs | 24 + .../UnifiedDbContextModelSnapshot.cs | 4 + .../CmsKit/Admin/Pages/CreatePageInputDto.cs | 3 + .../Volo/CmsKit/Admin/Pages/PageDto.cs | 2 + .../CmsKit/Admin/Pages/UpdatePageInputDto.cs | 3 + .../CmsKit/Admin/Pages/PageAdminAppService.cs | 3 +- .../Pages/CmsKit/Pages/Create.cshtml | 44 +- .../Pages/CmsKit/Pages/Create.cshtml.cs | 11 +- .../Pages/CmsKit/Pages/Index.cshtml | 2 - .../Pages/CmsKit/Pages/Update.cshtml | 1 - .../Pages/CmsKit/Pages/Update.cshtml.cs | 3 - .../Pages/CmsKit/Pages/create.js | 116 +- .../Volo/CmsKit/Pages/PageConsts.cs | 2 + .../Volo/CmsKit/Pages/Page.cs | 22 +- .../CmsKitDbContextModelCreatingExtensions.cs | 1 + .../Volo/CmsKit/Public/Pages/PageDto.cs | 2 + .../Shared/Components/Pages/Default.cshtml | 10 +- .../Pages/DefaultPageViewComponent.cs | 7 +- .../Pages/Public/CmsKit/Pages/Index.cshtml | 3 +- .../Pages/PageAdminAppService_Tests.cs | 9 +- .../CmsKitDataSeedContributor.cs | 10 +- 22 files changed, 2218 insertions(+), 84 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.Designer.cs new file mode 100644 index 0000000000..6c89519250 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.Designer.cs @@ -0,0 +1,2020 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210302091451_Added_Content_To_Page")] + partial class Added_Content_To_Page + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsContents"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + 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.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .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("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + 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/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.cs new file mode 100644 index 0000000000..b7ae92ccc7 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210302091451_Added_Content_To_Page.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Content_To_Page : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Content", + table: "CmsPages", + type: "nvarchar(max)", + maxLength: 2147483647, + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Content", + table: "CmsPages"); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index e3e9f4cc68..c14e469499 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1537,6 +1537,10 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(40)") .HasColumnName("ConcurrencyStamp"); + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs index 465408a8bf..174278d829 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/CreatePageInputDto.cs @@ -16,5 +16,8 @@ namespace Volo.CmsKit.Admin.Pages [Required] [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] public string Slug { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxContentLength))] + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs index e8117ed7b1..5297e9b7d0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/PageDto.cs @@ -9,5 +9,7 @@ namespace Volo.CmsKit.Admin.Pages public string Title { get; set; } public string Slug { get; set; } + + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs index f33c40be6a..eff3cb2919 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Pages/UpdatePageInputDto.cs @@ -16,5 +16,8 @@ namespace Volo.CmsKit.Admin.Pages [Required] [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] public string Slug { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxContentLength))] + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs index 9016a620c8..102b2a6afd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Pages/PageAdminAppService.cs @@ -50,7 +50,7 @@ namespace Volo.CmsKit.Admin.Pages { await CheckPageSlugAsync(input.Slug); - var page = new Page(GuidGenerator.Create(), input.Title, input.Slug, CurrentTenant.Id); + var page = new Page(GuidGenerator.Create(), input.Title, input.Slug, input.Content, CurrentTenant.Id); await PageRepository.InsertAsync(page); @@ -69,6 +69,7 @@ namespace Volo.CmsKit.Admin.Pages page.SetTitle(input.Title); page.SetSlug(input.Slug); + page.SetContent(input.Content); await PageRepository.UpdateAsync(page); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml index fe9f8d4b69..f7a584c940 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml @@ -1,9 +1,10 @@ @page -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor +@using System.Globalization +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy @using Volo.CmsKit.Admin.Web.Pages @using Volo.CmsKit.Admin.Web.Menus -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages @using Volo.CmsKit.Admin.Web.Bundles @inherits CmsKitAdminPageBase @@ -17,27 +18,36 @@ } @section scripts { - - - - + + + + + + +} + +@section styles { + + + } - - - +
+ + - - - @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new - { - entityType = "Page", - displaySubmitButton = false - }) - + + + +
+
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs index a4d90abafb..430c516ce3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml.cs @@ -2,10 +2,8 @@ using Microsoft.AspNetCore.Mvc; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; using Volo.Abp.Validation; using Volo.CmsKit.Admin.Pages; -using Volo.CmsKit.Admin.Web.Pages; using Volo.CmsKit.Pages; namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages @@ -34,14 +32,17 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages [AutoMap(typeof(CreatePageInputDto), ReverseMap = true)] public class CreatePageViewModel { - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] [Required] - [DynamicFormIgnore] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] public string Slug { get; set; } + + [HiddenInput] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] + public string Content { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml index 59fa975e24..c85d4759ba 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Index.cshtml @@ -1,6 +1,4 @@ @page - -@using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageSearchBox @using Volo.CmsKit.Admin.Web.Pages diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml index 90f043e89e..35507ef2ae 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml @@ -2,7 +2,6 @@ @using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor @using Volo.CmsKit.Admin.Web.Menus -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages @using Volo.CmsKit.Admin.Web.Pages @inherits CmsKitAdminPageBase diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs index e0b2d8b1b1..c80714aa91 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs @@ -1,10 +1,7 @@ using AutoMapper; using Microsoft.AspNetCore.Mvc; using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; using Volo.Abp.Validation; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js index d0a27aefe3..029ab189cd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js @@ -1,22 +1,25 @@ $(function () { var l = abp.localization.getResource("CmsKit"); - var $formCreate = $('#form-page-create'); + var $createForm = $('#form-page-create'); var $title = $('#ViewModel_Title'); var $slug = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-page-create'); - var $pageContentInput = $('#ViewModel_Value'); - $formCreate.on('submit', function (e) { + $createForm.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; + + $createForm.on('submit', function (e) { e.preventDefault(); - if ($formCreate.valid()) { + if ($createForm.valid()) { abp.ui.setBusy(); - $formCreate.ajaxSubmit({ + $createForm.ajaxSubmit({ success: function (result) { - submitEntityContent(result.id); + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/CmsKit/Pages/"; } }); } @@ -24,28 +27,9 @@ $buttonSubmit.click(function (e) { e.preventDefault(); - $formCreate.submit(); + $createForm.submit(); }); - function submitEntityContent(pageId) { - volo.cmsKit.admin.contents.contentAdmin - .create( - { - entityType: 'Page', - entityId: pageId, - value: $pageContentInput.val() - }) - .then(function (result) { - finishSaving(); - }); - } - - function finishSaving() { - abp.notify.success(l('SuccessfullySaved')); - abp.ui.clearBusy(); - location.href = "/CmsKit/Pages/"; - } - var slugEdited = false; $title.on('change paste keyup', function () { @@ -69,4 +53,84 @@ $slug.change(function () { slugEdited = true; }); + + // ----------------------------------- + function getUppyHeaders() { + var headers = {}; + headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); + + return headers; + } + + var fileUploadUri = "/api/cms-kit-admin/media/page"; + var fileUriPrefix = "/api/cms-kit/media/"; + + var editorDataKey = "tuiEditor"; + + initAllEditors(); + + function initAllEditors() { + $('.content-editor').each(function (i, item) { + initEditor(item); + }); + } + + function initEditor(element) { + var $editorContainer = $(element); + var inputName = $editorContainer.data('input-id'); + var $editorInput = $('#' + inputName); + var initialValue = $editorInput.val(); + + var editor = $editorContainer.tuiEditor({ + usageStatistics: false, + useCommandShortcut: true, + initialValue: initialValue, + previewStyle: 'tab', + height: "25em", + minHeight: "25em", + initialEditType: initialValue ? 'wysiwyg' : 'markdown', + language: $editorContainer.data("language"), + hooks: { + addImageBlobHook: uploadFile, + }, + events: { + change: function (_val) { + $editorInput.val(editor.getHtml()); + $editorInput.trigger("change"); + } + } + }).data(editorDataKey); + } + + function uploadFile(blob, callback, source) { + var UPPY_OPTIONS = { + endpoint: fileUploadUri, + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + UPPY.addFile({ + id: "content-file", + name: blob.name, + type: blob.type, + data: blob, + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error("File upload failed"); + } else { + var mediaDto = result.successful[0].response.body; + var fileUrl = (fileUriPrefix + mediaDto.id); + + callback(fileUrl, mediaDto.name); + } + }); + } }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs index 47d82b5d07..9858f30e14 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -5,5 +5,7 @@ public static int MaxTitleLength { get; set; } = 256; public static int MaxSlugLength { get; set; } = 256; + + public static int MaxContentLength { get; set; } = int.MaxValue; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs index 9c0ee2d6b9..dd759ebd08 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs @@ -8,22 +8,25 @@ namespace Volo.CmsKit.Pages { public class Page : FullAuditedAggregateRoot, IMultiTenant { - [CanBeNull] public virtual Guid? TenantId { get; protected set; } + public virtual Guid? TenantId { get; protected set; } - [NotNull] public virtual string Title { get; protected set; } + public virtual string Title { get; protected set; } - [NotNull] public virtual string Slug { get; protected set; } + public virtual string Slug { get; protected set; } + public virtual string Content { get; protected set; } + protected Page() { } - public Page(Guid id, [NotNull] string title, [NotNull] string slug, [CanBeNull]Guid? tenantId = null) : base(id) + public Page(Guid id, [NotNull] string title, [NotNull] string slug, string content = null, Guid? tenantId = null) : base(id) { - Title = Check.NotNullOrEmpty(title, nameof(title), PageConsts.MaxTitleLength); - Slug = Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength); - TenantId = tenantId; + + SetTitle(title); + SetSlug(slug); + SetContent(content); } public virtual void SetTitle(string title) @@ -35,5 +38,10 @@ namespace Volo.CmsKit.Pages { Slug = Check.NotNullOrEmpty(slug, nameof(slug), PageConsts.MaxSlugLength); } + + public virtual void SetContent(string content) + { + Content = Check.Length(content, nameof(content), PageConsts.MaxContentLength); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 8208dd38ea..14200c5c24 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -179,6 +179,7 @@ namespace Volo.CmsKit.EntityFrameworkCore b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength); b.Property(x => x.Slug).IsRequired().HasMaxLength(PageConsts.MaxSlugLength); + b.Property(x => x.Content).HasMaxLength(PageConsts.MaxContentLength); b.HasIndex(x => new { x.TenantId, Url = x.Slug }); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs index 2add3c9d38..682c90b8c8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Pages/PageDto.cs @@ -9,5 +9,7 @@ namespace Volo.CmsKit.Public.Pages public string Title { get; set; } public string Slug { get; set; } + + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml index e10fa0754a..ae23d5757f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml @@ -1,8 +1,5 @@ @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap - -@using Microsoft.AspNetCore.Mvc.RazorPages @using Volo.Abp.AspNetCore.Mvc.UI.Layout -@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages.PageViewModel @inject IPageLayout PageLayout @@ -12,11 +9,6 @@ - @await Component.InvokeAsync(typeof(ContentViewComponent), - new - { - entityType = nameof(Page), - entityId = Model.Id.ToString() - }) + @Html.Raw(Model.Content) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs index c972643359..3c8be1c2c3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs @@ -16,12 +16,13 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages PagePublicAppService = pagePublicAppService; } - public virtual async Task InvokeAsync(Guid pageId, string title, string description) + public virtual async Task InvokeAsync(Guid pageId, string title, string content) { var model = new PageViewModel { Id = pageId, - Title = title + Title = title, + Content = content }; return View("~/Pages/CmsKit/Shared/Components/Pages/Default.cshtml", model); @@ -33,5 +34,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages public Guid Id { get; set; } public string Title { get; set; } + + public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml index 6060c00304..426b5ebacf 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml @@ -9,5 +9,6 @@ new { pageId = Model.Page.Id, - title = Model.Page.Title + title = Model.Page.Title, + content = Model.Page.Content }) \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs index c3e82c58f1..766c482ddd 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Pages/PageAdminAppService_Tests.cs @@ -64,7 +64,8 @@ namespace Volo.CmsKit.Pages var dto = new CreatePageInputDto { Title = "test", - Slug = "test-url" + Slug = "test-url", + Content = "test*content" }; await Should.NotThrowAsync(async () => await _pageAdminAppService.CreateAsync(dto)); @@ -94,7 +95,8 @@ namespace Volo.CmsKit.Pages var dto = new UpdatePageInputDto { Title = _data.Page_1_Title + "++", - Slug = _data.Page_1_Slug+ "test" + Slug = _data.Page_1_Slug+ "test", + Content = "changed" }; await Should.NotThrowAsync(async () => await _pageAdminAppService.UpdateAsync(_data.Page_1_Id, dto)); @@ -106,6 +108,9 @@ namespace Volo.CmsKit.Pages updatedPage.Slug.ShouldNotBe(_data.Page_1_Slug); updatedPage.Slug.ShouldBe(dto.Slug); + + updatedPage.Content.ShouldNotBe(_data.Content_1); + updatedPage.Content.ShouldBe(dto.Content); } [Fact] diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 00969c46ab..504961cf0c 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -338,17 +338,11 @@ namespace Volo.CmsKit private async Task SeedPagesAsync() { - var page1 = new Page(_cmsKitTestData.Page_1_Id, _cmsKitTestData.Page_1_Title, _cmsKitTestData.Page_1_Slug); - var page1Content = new Content(_guidGenerator.Create(), nameof(Page), page1.Id.ToString(), _cmsKitTestData.Page_1_Content); - + var page1 = new Page(_cmsKitTestData.Page_1_Id, _cmsKitTestData.Page_1_Title, _cmsKitTestData.Page_1_Slug, _cmsKitTestData.Content_1); await _pageRepository.InsertAsync(page1); - await _contentRepository.InsertAsync(page1Content); - - var page2 = new Page(_cmsKitTestData.Page_2_Id, _cmsKitTestData.Page_2_Title, _cmsKitTestData.Page_2_Slug); - var page2Content = new Content(_guidGenerator.Create(), nameof(Page), page2.Id.ToString(), _cmsKitTestData.Page_2_Content); + var page2 = new Page(_cmsKitTestData.Page_2_Id, _cmsKitTestData.Page_2_Title, _cmsKitTestData.Page_2_Slug, _cmsKitTestData.Content_2); await _pageRepository.InsertAsync(page2); - await _contentRepository.InsertAsync(page2Content); } private async Task SeedBlogsAsync() From 40bab24cca024ecf18ef0b4c0c533be7a277caf7 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 13:23:17 +0300 Subject: [PATCH 010/101] CmsKit - Remove Media Permissions --- .../Permissions/CmsKitAdminPermissionDefinitionProvider.cs | 7 ------- .../Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs | 7 ------- .../MediaDescriptors/MediaDescriptorAdminAppService.cs | 3 --- .../MediaDescriptors/MediaDescriptorAdminController.cs | 4 ---- 4 files changed, 21 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index ccb4d1048b..a8317b6b6b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -56,13 +56,6 @@ namespace Volo.CmsKit.Permissions blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Update, L("Permission:BlogPostManagement.Update")); blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Delete, L("Permission:BlogPostManagement.Delete")); } - - if (GlobalFeatureManager.Instance.IsEnabled()) - { - var mediaDescriptorManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.MediaDescriptors.Default, L("Permission:MediaDescriptorManagement")); - mediaDescriptorManagement.AddChild(CmsKitAdminPermissions.MediaDescriptors.Create, L("Permission:MediaDescriptorManagement:Create")); - mediaDescriptorManagement.AddChild(CmsKitAdminPermissions.MediaDescriptors.Delete, L("Permission:MediaDescriptorManagement:Delete")); - } } private static LocalizableString L(string name) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs index baa26b0fff..c524e7e6b5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissions.cs @@ -52,12 +52,5 @@ namespace Volo.CmsKit.Permissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } - - public static class MediaDescriptors - { - public const string Default = GroupName + ".MediaDescriptors"; - public const string Create = Default + ".Create"; - public const string Delete = Default + ".Delete"; - } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index ba2b1a70b5..45774ca1f2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -10,7 +10,6 @@ using Volo.CmsKit.Permissions; namespace Volo.CmsKit.Admin.MediaDescriptors { [RequiresGlobalFeature(typeof(MediaFeature))] - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Default)] public class MediaDescriptorAdminAppService : CmsKitAdminAppServiceBase, IMediaDescriptorAdminAppService { protected IBlobContainer MediaContainer { get; } @@ -30,7 +29,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors MediaDescriptorDefinitionStore = mediaDescriptorDefinitionStore; } - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task CreateAsync(CreateMediaInputStream inputStream) { var definition = await MediaDescriptorDefinitionStore.GetDefinitionAsync(inputStream.EntityType); @@ -49,7 +47,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors } } - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Delete)] public virtual async Task DeleteAsync(Guid id) { var mediaDescriptor = await MediaDescriptorRepository.GetAsync(id); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs index 124cfcba1c..91cd5170a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminController.cs @@ -13,7 +13,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors { [RequiresGlobalFeature(typeof(MediaFeature))] [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Default)] [Area("cms-kit")] [Route("api/cms-kit-admin/media")] public class MediaDescriptorAdminController : CmsKitAdminController, IMediaDescriptorAdminAppService @@ -26,7 +25,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors } [HttpPost] - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] [NonAction] public virtual Task CreateAsync(CreateMediaInputStream inputStream) { @@ -35,7 +33,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [HttpDelete] [Route("{id}")] - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Delete)] public virtual Task DeleteAsync(Guid id) { return MediaDescriptorAdminAppService.DeleteAsync(id); @@ -43,7 +40,6 @@ namespace Volo.CmsKit.Admin.MediaDescriptors [HttpPost] [Route("{entityType}")] - [Authorize(CmsKitAdminPermissions.MediaDescriptors.Create)] public virtual async Task UploadAsync(string entityType, IFormFile file) { if (file == null) From 0d9b602f7e5454822abdb6d0f1d5a1323724cc63 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 13:23:30 +0300 Subject: [PATCH 011/101] CmsKit - Add policies to test data --- .../test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index e2c928be2a..8fd8b14f46 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -136,7 +136,11 @@ namespace Volo.CmsKit _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.Content_2_EntityType)); _tagOptions.Value.EntityTypes.AddIfNotContains(new TagEntityTypeDefiniton(_cmsKitTestData.TagDefinition_1_EntityType)); - _mediaOptions.Value.EntityTypes.AddIfNotContains(new MediaDescriptorDefinition(_cmsKitTestData.Media_1_EntityType)); + _mediaOptions.Value.EntityTypes.AddIfNotContains( + new MediaDescriptorDefinition( + _cmsKitTestData.Media_1_EntityType, + createPolicies: new[] { "SomeCreatePolicy" }, + deletePolicies: new[] { "SomeDeletePolicy" })); return Task.CompletedTask; } From 5e32bfd579220ae0779032b5ce13e84d789789e8 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 13:29:07 +0300 Subject: [PATCH 012/101] CmsKit - Refactoring for DefaultMediaDescriptorDefinitionStore --- .../MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs index 4bdd4d6e98..5a1553c3fc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs @@ -25,7 +25,7 @@ namespace Volo.CmsKit.MediaDescriptors /// EntityType to get definition. /// Thrown when EntityType is not configured as taggable. /// More than one element satisfies the condition in predicate. - public Task GetDefinitionAsync([NotNull] string entityType) + public virtual Task GetDefinitionAsync([NotNull] string entityType) { Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); @@ -35,7 +35,7 @@ namespace Volo.CmsKit.MediaDescriptors return Task.FromResult(result); } - public Task IsDefinedAsync([NotNull] string entityType) + public virtual Task IsDefinedAsync([NotNull] string entityType) { Check.NotNullOrEmpty(entityType, nameof(entityType)); From 2c089a24433191d0bde664bb8111cbb7ae33290f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 13:30:47 +0300 Subject: [PATCH 013/101] remove content from cms-kit --- ...CmsKitAdminApplicationAutoMapperProfile.cs | 7 - .../Admin/Contents/ContentAdminAppService.cs | 71 --------- .../Pages/CmsKit/BlogPosts/Create.cshtml | 1 - .../Pages/CmsKit/BlogPosts/Update.cshtml | 1 - .../ContentEditorViewComponent.cs | 44 ------ .../Components/ContentEditor/Default.cshtml | 7 - .../Components/ContentEditor/default.js | 80 ---------- .../EntityContentEditor/ContentViewModel.cs | 28 ---- .../EntityContentEditor/Default.cshtml | 27 ---- .../EntityContentEditorViewComponent.cs | 65 -------- .../Components/EntityContentEditor/default.js | 34 ----- .../Pages/CmsKit/Pages/Create.cshtml | 2 +- .../Pages/CmsKit/Pages/Update.cshtml | 11 +- .../Volo/CmsKit/Contents/Content.cs | 44 ------ .../Contents/ContentAlreadyExistException.cs | 17 --- .../Volo/CmsKit/Contents/ContentManager.cs | 32 ---- .../Volo/CmsKit/Contents/IContentManager.cs | 11 -- .../CmsKit/Contents/IContentRepository.cs | 35 ----- .../Contents/EfCoreContentRepository.cs | 86 ----------- .../EntityFrameworkCore/CmsKitDbContext.cs | 2 - .../CmsKitDbContextModelCreatingExtensions.cs | 21 --- .../CmsKitEntityFrameworkCoreModule.cs | 1 - .../EntityFrameworkCore/ICmsKitDbContext.cs | 2 - .../CmsKit/MongoDB/CmsKitMongoDbContext.cs | 2 - .../MongoDB/CmsKitMongoDbContextExtensions.cs | 5 - .../CmsKit/MongoDB/CmsKitMongoDbModule.cs | 3 - .../Contents/MongoContentRepository.cs | 80 ---------- .../CmsKit/MongoDB/ICmsKitMongoDbContext.cs | 2 - .../Contents/ContentPublicAppService.cs | 25 --- .../PublicApplicationAutoMapperProfile.cs | 4 - .../Contents/ContentAdminAppService_Tests.cs | 142 ------------------ .../Contents/ContentRepository_Test.cs | 9 -- .../Contents/ContentRepository_Test.cs | 11 -- .../CmsKitDataSeedContributor.cs | 39 ----- .../Contents/ContentRepository_Tests.cs | 63 -------- 35 files changed, 2 insertions(+), 1012 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs delete mode 100644 modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs delete mode 100644 modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs delete mode 100644 modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs delete mode 100644 modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs index b78910ce01..a2615292f0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationAutoMapperProfile.cs @@ -2,13 +2,11 @@ using Volo.Abp.AutoMapper; using Volo.CmsKit.Admin.Blogs; using Volo.CmsKit.Admin.Comments; -using Volo.CmsKit.Admin.Contents; using Volo.CmsKit.Admin.MediaDescriptors; using Volo.CmsKit.Admin.Pages; using Volo.CmsKit.Blogs; using Volo.CmsKit.Admin.Tags; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Tags; @@ -28,11 +26,6 @@ namespace Volo.CmsKit.Admin CreateMap(); - CreateMap(MemberList.Destination); - CreateMap(MemberList.Destination); - CreateMap(MemberList.Source); - CreateMap(MemberList.Source); - CreateMap(MemberList.Destination); CreateMap(MemberList.Source); CreateMap(MemberList.Source); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs deleted file mode 100644 index 1aa0bffcfa..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Contents/ContentAdminAppService.cs +++ /dev/null @@ -1,71 +0,0 @@ -using JetBrains.Annotations; -using Microsoft.AspNetCore.Authorization; -using System; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Application.Services; -using Volo.Abp.Domain.Repositories; -using Volo.CmsKit.Contents; -using Volo.CmsKit.Permissions; - -namespace Volo.CmsKit.Admin.Contents -{ - [Authorize(CmsKitAdminPermissions.Contents.Default)] - public class ContentAdminAppService : - CrudAppService< - Content, - ContentDto, - ContentGetListDto, - Guid, - ContentGetListInput, - ContentCreateDto, - ContentUpdateDto - >, IContentAdminAppService - { - protected IContentManager ContentManager { get; } - - protected IContentRepository ContentRepository { get; } - - public ContentAdminAppService( - IRepository repository, - IContentManager contentManager, - IContentRepository contentRepository) : base(repository) - { - ContentManager = contentManager; - ContentRepository = contentRepository; - - GetListPolicyName = CmsKitAdminPermissions.Contents.Default; - GetPolicyName = CmsKitAdminPermissions.Contents.Default; - CreatePolicyName = CmsKitAdminPermissions.Contents.Create; - UpdatePolicyName = CmsKitAdminPermissions.Contents.Update; - DeletePolicyName = CmsKitAdminPermissions.Contents.Delete; - } - - [Authorize(CmsKitAdminPermissions.Contents.Create)] - public override async Task CreateAsync(ContentCreateDto input) - { - var entity = new Content( - GuidGenerator.Create(), - input.EntityType, - input.EntityId, - input.Value, - CurrentTenant?.Id); - - await ContentManager.InsertAsync(entity); - - return await MapToGetOutputDtoAsync(entity); - } - - public virtual async Task GetAsync( - [NotNull] string entityType, - [NotNull] string entityId) - { - Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); - Check.NotNullOrWhiteSpace(entityId, nameof(entityId)); - - var content = await ContentRepository.GetAsync(entityType, entityId, CurrentTenant?.Id); - - return ObjectMapper.Map(content); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml index 8440bc0c40..4659ca4198 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml @@ -2,7 +2,6 @@ @using System.Globalization @using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar @using Volo.CmsKit.Admin.Web.Pages @using Volo.CmsKit.Admin.Web.Menus diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml index b9a1dbb638..7c56152b8e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml @@ -5,7 +5,6 @@ @using Volo.CmsKit.Blogs @using Volo.CmsKit.Admin.Web.Pages @using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageToolbar -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor @using Volo.CmsKit.Admin.Web.Menus @using Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts @using Volo.CmsKit.Admin.Web.Pages.CmsKit.Tags.Components.TagEditor diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs deleted file mode 100644 index bba95a0e45..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/ContentEditorViewComponent.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ViewFeatures; -using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor; -using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy; -using Volo.Abp.AspNetCore.Mvc.UI.Widgets; - -namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor -{ - [Widget( - StyleTypes = new[] - { - typeof(TuiEditorStyleContributor) - }, - ScriptTypes = new[] - { - typeof(TuiEditorScriptContributor), - typeof(UppyScriptContributor) - }, - ScriptFiles = new[] - { - "/Pages/CmsKit/Contents/Components/ContentEditor/default.js" - })] - public class ContentEditorViewComponent : AbpViewComponent - { - public async Task InvokeAsync(string inputId) - { - return View( - "~/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml", - new ContentEditorViewModel(inputId)); - } - - public class ContentEditorViewModel - { - public ContentEditorViewModel(string inputId) - { - InputId = inputId; - } - - public string InputId { get; set; } - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml deleted file mode 100644 index cde532b02c..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/Default.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@using System.Globalization -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor - -@model ContentEditorViewComponent.ContentEditorViewModel - -
-
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js deleted file mode 100644 index a6ccbbde65..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/ContentEditor/default.js +++ /dev/null @@ -1,80 +0,0 @@ -$(function () { - var fileUploadUri = "/api/cms-kit-admin/media"; - var fileUriPrefix = "/api/cms-kit/media/"; - - var editorDataKey = "tuiEditor"; - - initAllEditors(); - - function initAllEditors() { - $('.content-editor').each(function (i, item) { - initEditor(item); - }); - } - - function initEditor(element) { - var $editorContainer = $(element); - var inputName = $editorContainer.data('input-id'); - var $editorInput = $('#' + inputName); - var initialValue = $editorInput.val(); - - var editor = $editorContainer.tuiEditor({ - usageStatistics: false, - useCommandShortcut: true, - initialValue: initialValue, - previewStyle: 'tab', - height: "25em", - minHeight: "25em", - initialEditType: initialValue ? 'wysiwyg' : 'markdown', - language: $editorContainer.data("language"), - hooks: { - addImageBlobHook: uploadFile, - }, - events: { - change: function (_val) { - $editorInput.val(editor.getHtml()); - $editorInput.trigger("change"); - } - } - }).data(editorDataKey); - } - - function getUppyHeaders() { - var headers = {}; - headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); - - return headers; - } - - function uploadFile(blob, callback, source) { - var UPPY_OPTIONS = { - endpoint: fileUploadUri, - formData: true, - fieldName: "file", - method: "post", - headers: getUppyHeaders() - }; - - var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); - - UPPY.reset(); - - UPPY.addFile({ - id: "content-file", - name: blob.name, - type: blob.type, - data: blob, - }); - - UPPY.upload().then((result) => { - if (result.failed.length > 0) { - abp.message.error("File upload failed"); - } else { - var mediaDto = result.successful[0].response.body; - var fileUrl = (fileUriPrefix + mediaDto.id); - - callback(fileUrl, mediaDto.name); - } - }); - } -}); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs deleted file mode 100644 index 891fe50bd1..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/ContentViewModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; - -namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor -{ - public class ContentViewModel - { - public ContentViewModel(string entityType, string entityId, string value = null, Guid? id = null) - { - EntityType = entityType; - EntityId = entityId; - Value = value; - Id = id; - } - - [HiddenInput] - public string EntityType { get; set; } - - [HiddenInput] - public string EntityId { get; set; } - - [HiddenInput] - public string Value { get; set; } - - [HiddenInput] - public Guid? Id { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml deleted file mode 100644 index ba8132ccc1..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml +++ /dev/null @@ -1,27 +0,0 @@ -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.ContentEditor -@using Volo.CmsKit.Localization -@using Microsoft.Extensions.Localization - -@model EntityContentEditorViewComponent.EntityContentEditorViewModel - -@inject IStringLocalizer L - -@if (Model.DisplaySubmitButton) -{ - - - - - - -} -else -{ - - - - -} - -@await Component.InvokeAsync(typeof(ContentEditorViewComponent), new { inputId = Html.IdFor(m => m.ViewModel.Value) }) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs deleted file mode 100644 index 44db557f16..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/EntityContentEditorViewComponent.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; -using Volo.Abp.AspNetCore.Mvc.UI.Widgets; -using Volo.Abp.Domain.Entities; -using Volo.CmsKit.Admin.Contents; - -namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor -{ - [Widget( - ScriptFiles = new[] - { - "/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js" - })] - public class EntityContentEditorViewComponent : AbpViewComponent - { - private readonly IContentAdminAppService contentAdminAppService; - - public EntityContentEditorViewComponent(IContentAdminAppService contentAdminAppService) - { - this.contentAdminAppService = contentAdminAppService; - } - - public async Task InvokeAsync(string entityType, string entityId, bool displaySubmitButton = true) - { - var viewModel = new ContentViewModel(entityType, entityId); - - try - { - if (entityId != null) - { - var content = await contentAdminAppService.GetAsync(entityType, entityId); - viewModel.Value = content.Value; - viewModel.Id = content.Id; - } - } - catch (EntityNotFoundException) - { - // Initialize editor even content doesn't exist. - } - - return View( - "~/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml", - new EntityContentEditorViewModel(viewModel, displaySubmitButton)); - } - - public class EntityContentEditorViewModel - { - public ContentViewModel ViewModel { get; set; } - - public bool DisplaySubmitButton { get; set; } - - public EntityContentEditorViewModel(ContentViewModel viewModel, bool displaySubmitButton) - { - ViewModel = viewModel; - DisplaySubmitButton = displaySubmitButton; - } - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js deleted file mode 100644 index 34f84f8419..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/Components/EntityContentEditor/default.js +++ /dev/null @@ -1,34 +0,0 @@ -$(function () { - - $entityContentEditors = $('.form-entity-content-editor'); - - var contentAdminService = volo.cmsKit.admin.contents.contentAdmin; - - $entityContentEditors.on('submit', function (e, obj) { - e.preventDefault(); - - var $form = $(e.currentTarget); - - if ($form.valid()) { - - var data = form.serializeFormToObject().viewModel; - - abp.ui.setBusy(e); - if (data.id) { - contentAdminService - .update(data.id, data) - .then(function (result) { - abp.ui.clearBusy(); - }); - - } - else { - contentAdminService - .create(data) - .then(function (result) { - abp.ui.clearBusy(); - }); - } - } - }) -}) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml index f7a584c940..b4896a7449 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml @@ -9,7 +9,7 @@ @inherits CmsKitAdminPageBase -@model CreateModel +@model Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages.CreateModel @{ PageLayout.Content.Title = L["Pages"].Value; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml index 35507ef2ae..c79ff8b72c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml @@ -1,12 +1,11 @@ @page "{Id}" -@using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents.Components.EntityContentEditor @using Volo.CmsKit.Admin.Web.Menus @using Volo.CmsKit.Admin.Web.Pages @inherits CmsKitAdminPageBase -@model UpdateModel +@model Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages.UpdateModel @{ PageLayout.Content.Title = L["Pages"].Value; @@ -29,14 +28,6 @@ - - @await Component.InvokeAsync(typeof(EntityContentEditorViewComponent), new - { - entityType = "Page", - entityId = Model.Id.ToString(), - displaySubmitButton = false - }) - diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs deleted file mode 100644 index 392abfbc6f..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using JetBrains.Annotations; -using Volo.Abp; -using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.MultiTenancy; - -namespace Volo.CmsKit.Contents -{ - public class Content : FullAuditedAggregateRoot, IMultiTenant - { - [CanBeNull] public virtual Guid? TenantId { get; protected set; } - - [NotNull] public virtual string EntityType { get; protected set; } - - [NotNull] public virtual string EntityId { get; protected set; } - - [NotNull] public virtual string Value { get; protected set; } - - protected Content() - { - } - - public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value, - Guid? tenantId = null) : base(id) - { - EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); - EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); - Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength); - - TenantId = tenantId; - } - - public virtual void SetValue([NotNull] string value) - { - Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength); - } - - public virtual void SetEntity([NotNull] string entityType, [NotNull] string entityId) - { - EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); - EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs deleted file mode 100644 index 8ea4d4c54a..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentAlreadyExistException.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using System; -using Volo.Abp; - -namespace Volo.CmsKit.Contents -{ - [Serializable] - public class ContentAlreadyExistException : BusinessException - { - public ContentAlreadyExistException([NotNull] string entityType, [NotNull] string entityId) - { - Code = CmsKitErrorCodes.ContentAlreadyExist; - WithData(nameof(Content.EntityType), entityType); - WithData(nameof(Content.EntityId), entityId); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs deleted file mode 100644 index 707f15bbb9..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/ContentManager.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Services; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Contents -{ - public class ContentManager : DomainService, IContentManager - { - protected IContentRepository ContentRepository { get; } - - public ContentManager(IContentRepository contentRepository) - { - ContentRepository = contentRepository; - } - - public virtual async Task InsertAsync(Content content, CancellationToken cancellationToken = default) - { - if (await ContentRepository.ExistsAsync(content.EntityType, content.EntityId, content.TenantId, - cancellationToken)) - { - throw new ContentAlreadyExistException(content.EntityType, content.EntityId); - } - - return await ContentRepository.InsertAsync(content, cancellationToken: cancellationToken); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs deleted file mode 100644 index d64bd0effe..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentManager.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Contents -{ - public interface IContentManager - { - Task InsertAsync(Content content, CancellationToken cancellationToken = default); - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs deleted file mode 100644 index 3b767b4722..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs +++ /dev/null @@ -1,35 +0,0 @@ -using JetBrains.Annotations; -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; - -namespace Volo.CmsKit.Contents -{ - public interface IContentRepository : IBasicRepository - { - Task GetAsync( - [NotNull] string entityType, - [NotNull] string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default); - - Task FindAsync( - [NotNull] string entityType, - [NotNull] string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default); - - Task DeleteAsync( - [NotNull] string entityType, - [NotNull] string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default); - - Task ExistsAsync( - [NotNull] string entityType, - [NotNull] string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs deleted file mode 100644 index 9a99bc5eca..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs +++ /dev/null @@ -1,86 +0,0 @@ -using JetBrains.Annotations; -using Microsoft.EntityFrameworkCore; -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; -using Volo.CmsKit.EntityFrameworkCore; - -namespace Volo.CmsKit.Contents -{ - public class EfCoreContentRepository : EfCoreRepository, IContentRepository - { - public EfCoreContentRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } - - public virtual Task GetAsync( - string entityType, - string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return GetAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken) - ); - } - - public virtual Task FindAsync( - string entityType, - string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return FindAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken) - ); - } - - public virtual Task DeleteAsync( - string entityType, - string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return DeleteAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken)); - } - - public virtual async Task ExistsAsync( - [NotNull] string entityType, - [NotNull] string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - var dbSet = await GetDbSetAsync(); - return await dbSet.AnyAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken)); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs index 749a0653f9..7fc05ea042 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContext.cs @@ -3,7 +3,6 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; @@ -16,7 +15,6 @@ namespace Volo.CmsKit.EntityFrameworkCore [ConnectionStringName(CmsKitDbProperties.ConnectionStringName)] public class CmsKitDbContext : AbpDbContext, ICmsKitDbContext { - public DbSet Contents { get; set; } public DbSet Comments { get; set; } public DbSet User { get; set; } public DbSet Reactions { get; set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs index 14200c5c24..57a8e062fc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitDbContextModelCreatingExtensions.cs @@ -8,7 +8,6 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; using Volo.Abp.Users.EntityFrameworkCore; -using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; @@ -111,26 +110,6 @@ namespace Volo.CmsKit.EntityFrameworkCore builder.Ignore(); } - if (GlobalFeatureManager.Instance.IsEnabled()) - { - builder.Entity(b => - { - b.ToTable(options.TablePrefix + "Contents", options.Schema); - - b.ConfigureByConvention(); - - b.Property(x => x.EntityType).IsRequired().HasMaxLength(ContentConsts.MaxEntityTypeLength); - b.Property(x => x.EntityId).IsRequired().HasMaxLength(ContentConsts.MaxEntityIdLength); - b.Property(x => x.Value).IsRequired().HasMaxLength(ContentConsts.MaxValueLength); - - b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId }); - }); - } - else - { - builder.Ignore(); - } - if (GlobalFeatureManager.Instance.IsEnabled()) { builder.Entity(b => diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs index 335bbb9f78..0bbb9ea58b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/CmsKitEntityFrameworkCoreModule.cs @@ -29,7 +29,6 @@ namespace Volo.CmsKit.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); - options.AddRepository(); options.AddRepository(); options.AddRepository(); options.AddRepository(); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs index 0299856341..0484676a94 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityFrameworkCore/ICmsKitDbContext.cs @@ -3,7 +3,6 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; @@ -16,7 +15,6 @@ namespace Volo.CmsKit.EntityFrameworkCore [ConnectionStringName(CmsKitDbProperties.ConnectionStringName)] public interface ICmsKitDbContext : IEfCoreDbContext { - DbSet Contents { get; } DbSet Comments { get; } DbSet User { get; } DbSet Reactions { get; } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs index cd03531448..4d8f86b823 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContext.cs @@ -24,8 +24,6 @@ namespace Volo.CmsKit.MongoDB public IMongoCollection CmsUsers => Collection(); public IMongoCollection Ratings => Collection(); - - public IMongoCollection Contents => Collection(); public IMongoCollection Tags => Collection(); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs index 2a542472d2..8585f988f9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbContextExtensions.cs @@ -47,11 +47,6 @@ namespace Volo.CmsKit.MongoDB x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Ratings"; }); - builder.Entity(x => - { - x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Contents"; - }); - builder.Entity(x => { x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Tags"; diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs index 11e3a0eb86..f18e92e2ba 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs @@ -4,11 +4,9 @@ using Volo.Abp.MongoDB; using Volo.Abp.Users.MongoDB; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.MongoDB.Blogs; using Volo.CmsKit.MongoDB.Comments; -using Volo.CmsKit.MongoDB.Contents; using Volo.CmsKit.MongoDB.MediaDescriptors; using Volo.CmsKit.MongoDB.Pages; using Volo.CmsKit.MongoDB.Ratings; @@ -38,7 +36,6 @@ namespace Volo.CmsKit.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); - options.AddRepository(); options.AddRepository(); options.AddRepository(); options.AddRepository(); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs deleted file mode 100644 index fded228c16..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs +++ /dev/null @@ -1,80 +0,0 @@ -using JetBrains.Annotations; -using MongoDB.Driver.Linq; -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Domain.Repositories.MongoDB; -using Volo.Abp.MongoDB; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.MongoDB.Contents -{ - public class MongoContentRepository : MongoDbRepository, IContentRepository - { - public MongoContentRepository(IMongoDbContextProvider dbContextProvider) : base( - dbContextProvider) - { - } - - public virtual Task GetAsync( - string entityType, - string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return GetAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken) - ); - } - - public virtual Task FindAsync( - string entityType, - string entityId, - Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return FindAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken) - ); - } - - public virtual Task DeleteAsync(string entityType, string entityId, Guid? tenantId = null, - CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return DeleteAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken)); - } - - public virtual async Task ExistsAsync([NotNull] string entityType, [NotNull] string entityId, - Guid? tenantId = null, CancellationToken cancellationToken = default) - { - Check.NotNullOrEmpty(entityType, nameof(entityType)); - Check.NotNullOrEmpty(entityId, nameof(entityId)); - - return await (await GetMongoQueryableAsync(cancellationToken)).AnyAsync(x => - x.EntityType == entityType && - x.EntityId == entityId && - x.TenantId == tenantId, - cancellationToken: GetCancellationToken(cancellationToken)); - } - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs index 742d40dfc6..5110bca501 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/ICmsKitMongoDbContext.cs @@ -25,8 +25,6 @@ namespace Volo.CmsKit.MongoDB IMongoCollection Ratings { get; } - IMongoCollection Contents { get; } - IMongoCollection Tags { get; } IMongoCollection EntityTags { get; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs deleted file mode 100644 index 995c99c2ed..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Contents/ContentPublicAppService.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Threading.Tasks; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Public.Contents -{ - public class ContentPublicAppService : CmsKitPublicAppServiceBase, IContentPublicAppService - { - protected IContentRepository ContentRepository { get; } - - public ContentPublicAppService(IContentRepository contentRepository) - { - ContentRepository = contentRepository; - } - - public virtual async Task GetAsync(GetContentInput input) - { - var entity = await ContentRepository.GetAsync( - input.EntityType, - input.EntityId, - CurrentTenant.Id); - - return ObjectMapper.Map(entity); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs index 46dab5a9a1..b8684f2463 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs @@ -2,11 +2,9 @@ using Volo.Abp.AutoMapper; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.Pages; using Volo.CmsKit.Public.Blogs; using Volo.CmsKit.Public.Comments; -using Volo.CmsKit.Public.Contents; using Volo.CmsKit.Public.Pages; using Volo.CmsKit.Public.Ratings; using Volo.CmsKit.Ratings; @@ -29,8 +27,6 @@ namespace Volo.CmsKit.Public CreateMap(); - CreateMap(); - CreateMap(); CreateMap(MemberList.None); diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs deleted file mode 100644 index 5c7e5969f1..0000000000 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Contents/ContentAdminAppService_Tests.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using NSubstitute; -using Shouldly; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Users; -using Volo.CmsKit.Admin.Contents; -using Xunit; - -namespace Volo.CmsKit.Contents -{ - public class ContentAdminAppService_Tests : CmsKitApplicationTestBase - { - private ICurrentUser _currentUser; - private readonly CmsKitTestData _data; - private readonly IContentAdminAppService _service; - public ContentAdminAppService_Tests() - { - _data = GetRequiredService(); - _service = GetRequiredService(); - } - - protected override void AfterAddApplication(IServiceCollection services) - { - _currentUser = Substitute.For(); - services.AddSingleton(_currentUser); - } - - [Fact] - public async Task ShouldGetListAsync() - { - var result = await _service.GetListAsync(new ContentGetListInput()); - - result.ShouldNotBeNull(); - result.Items.ShouldNotBeEmpty(); - result.Items.Count.ShouldBe(4); - result.Items.All(x => x.ShouldBeOfType() != null); - } - - [Fact] - public async Task ShouldGetAsync() - { - var result = await _service.GetAsync(_data.Content_1_Id); - - result.ShouldNotBeNull(); - result.ShouldBeOfType(); - result.ShouldNotBeNull(result.Value); - } - - [Fact] - public async Task ShouldCreateAsync() - { - var entityId = "1-2-3"; - var entityType = "My.Awesome.Blog"; - var value = "Some long content"; - - var created = await _service.CreateAsync(new ContentCreateDto - { - EntityId = entityId, - EntityType = entityType, - Value = value - }); - - created.Id.ShouldNotBe(Guid.Empty); - - var content = await _service.GetAsync(created.Id); - - content.ShouldNotBeNull(); - content.EntityType.ShouldBe(entityType); - } - - [Fact] - public async Task ShouldNotCreateWithSameParametersAsync() - { - var entityTtype = "My.Awesome.Book"; - var entityId = "1"; - - await _service.CreateAsync(new ContentCreateDto - { - EntityId = entityId, - EntityType = entityTtype, - Value = "Some long content" - }); - - await Should.ThrowAsync(async () => - await _service.CreateAsync(new ContentCreateDto - { - EntityId = entityId, - EntityType = entityTtype, - Value = "Yet another long content" - }) - ); - } - - [Fact] - public async Task ShouldUpdateAsync() - { - string newValue = "Newly created fresh value"; - var updateDto = new ContentUpdateDto - { - Value = newValue - }; - - await _service.UpdateAsync(_data.Content_1_Id, updateDto); - - var content = await _service.GetAsync(_data.Content_1_Id); - content.ShouldNotBeNull(); - content.Value.ShouldBe(newValue); - } - - [Fact] - public async Task ShouldDeleteAsync() - { - await _service.DeleteAsync(_data.Content_2_Id); - - await Should.ThrowAsync(async () => await _service.GetAsync(_data.Content_2_Id)); - } - - [Fact] - public async Task ShouldNotThrowEntityNotFoundExceptionWhileDeletingAlreadyDeletedAsync() - { - await _service.DeleteAsync(_data.Content_2_Id); - - await Should.NotThrowAsync(async () => - await _service.DeleteAsync(_data.Content_2_Id)); - } - - [Fact] - public async Task ShouldGetByEntityAsync() - { - var entity = await _service.GetAsync(_data.Content_1_EntityType, _data.Content_1_EntityId); - - entity.ShouldNotBeNull(); - entity.EntityId.ShouldBe(_data.Content_1_EntityId); - entity.EntityType.ShouldBe(_data.Content_1_EntityType); - } - } -} diff --git a/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs deleted file mode 100644 index 72f0b47485..0000000000 --- a/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.EntityFrameworkCore.Contents -{ - public class ContentRepository_Test : ContentRepository_Tests - { - - } -} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs deleted file mode 100644 index bb467a4844..0000000000 --- a/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.CmsKit.Contents; -using Xunit; - -namespace Volo.CmsKit.MongoDB.Contents -{ - [Collection(MongoTestCollection.Name)] - public class ContentRepository_Test : ContentRepository_Tests - { - - } -} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 504961cf0c..e8c5155377 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -2,19 +2,16 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp.BlobStoring; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.Users; using Volo.CmsKit.Blogs; using Volo.CmsKit.Comments; -using Volo.CmsKit.Contents; using Volo.CmsKit.MediaDescriptors; using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; @@ -33,7 +30,6 @@ namespace Volo.CmsKit private readonly ReactionManager _reactionManager; private readonly IRatingRepository _ratingRepository; private readonly ICurrentTenant _currentTenant; - private readonly IContentRepository _contentRepository; private readonly EntityTagManager _entityTagManager; private readonly TagManager _tagManager; private readonly ITagRepository _tagRepository; @@ -57,7 +53,6 @@ namespace Volo.CmsKit ReactionManager reactionManager, IRatingRepository ratingRepository, ICurrentTenant currentTenant, - IContentRepository contentRepository, TagManager tagManager, ITagRepository tagRepository, IEntityTagRepository entityTagRepository, @@ -80,7 +75,6 @@ namespace Volo.CmsKit _reactionManager = reactionManager; _ratingRepository = ratingRepository; _currentTenant = currentTenant; - _contentRepository = contentRepository; _tagManager = tagManager; _tagRepository = tagRepository; _entityTagManager = entityTagManager; @@ -111,8 +105,6 @@ namespace Volo.CmsKit await SeedRatingsAsync(); - await SeedContentsAsync(); - await SeedTagsAsync(); await SeedPagesAsync(); @@ -264,37 +256,6 @@ namespace Volo.CmsKit )); } - private async Task SeedContentsAsync() - { - var content1 = new Content( - _cmsKitTestData.Content_1_Id, - _cmsKitTestData.Content_1_EntityType, - _cmsKitTestData.Content_1_EntityId, - _cmsKitTestData.Content_1 - ); - - var content2 = new Content( - _cmsKitTestData.Content_2_Id, - _cmsKitTestData.Content_2_EntityType, - _cmsKitTestData.Content_2_EntityId, - _cmsKitTestData.Content_2 - ); - - var content3 = new Content( - Guid.NewGuid(), - "deleted_entity_type", - "deleted_entity_id", - "Content" - ) - { - IsDeleted = true, - }; - - await _contentRepository.InsertAsync(content1); - await _contentRepository.InsertAsync(content2); - await _contentRepository.InsertAsync(content3); - } - private async Task SeedTagsAsync() { var created1 = await _tagRepository.InsertAsync( diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs deleted file mode 100644 index c5b166551e..0000000000 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Threading.Tasks; -using Shouldly; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Modularity; -using Xunit; - -namespace Volo.CmsKit.Contents -{ - public abstract class ContentRepository_Tests : CmsKitTestBase - where TStartupModule : IAbpModule - { - private readonly CmsKitTestData _cmsKitTestData; - private readonly IContentRepository _contentRepository; - - protected ContentRepository_Tests() - { - _cmsKitTestData = GetRequiredService(); - _contentRepository = GetRequiredService(); - } - - [Theory] - [InlineData("Lyrics", "1", "First things first")] - [InlineData("LyricsAlso", "2", "Second thing second")] - public async Task ShouldGetAsync(string entityType, string entityId, string contentStartsWith = null) - { - var content = await _contentRepository.GetAsync(entityType, entityId); - - content.ShouldNotBeNull(); - - if (contentStartsWith != null) - { - content.Value.ShouldStartWith(contentStartsWith); - } - } - - [Fact] - public async Task ShouldNotGetAsync() - { - Should.Throw( - async () - => - await _contentRepository.GetAsync("not_exist_entity", Guid.NewGuid().ToString())); - } - - [Fact] - public async Task ShouldFindAsync() - { - var content = - await _contentRepository.FindAsync(_cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityId); - - content.ShouldNotBeNull(); - } - - [Fact] - public async Task ShouldNotFindAsync() - { - var content = await _contentRepository.FindAsync("not_exist_entity", Guid.NewGuid().ToString()); - - content.ShouldBeNull(); - } - } -} \ No newline at end of file From 0b34091a3f2a5ea112b6b077b2b83fd6bd33601a Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 13:39:03 +0300 Subject: [PATCH 014/101] remove content related classes --- .../Pages/Index.cshtml | 6 - .../CmsKit/Admin/Contents/ContentCreateDto.cs | 23 ---- .../Volo/CmsKit/Admin/Contents/ContentDto.cs | 15 --- .../Admin/Contents/ContentGetListDto.cs | 13 -- .../Admin/Contents/ContentGetListInput.cs | 10 -- .../CmsKit/Admin/Contents/ContentUpdateDto.cs | 15 --- .../Admin/Contents/IContentAdminAppService.cs | 19 --- .../Admin/Contents/ContentAdminController.cs | 71 ----------- .../Pages/CmsKit/Pages/Update.cshtml | 35 +++++- .../Pages/CmsKit/Pages/Update.cshtml.cs | 9 +- .../Pages/CmsKit/Pages/update.js | 114 ++++++++++++------ .../Volo/CmsKit/Public/Contents/ContentDto.cs | 11 -- .../CmsKit/Public/Contents/GetContentInput.cs | 12 -- .../Contents/IContentPublicAppService.cs | 10 -- .../Public/Contents/ContentController.cs | 29 ----- .../Components/Blogs/BlogPost/Default.cshtml | 2 - .../Contents/ContentViewComponent.cs | 59 --------- .../Shared/Components/Contents/Default.cshtml | 3 - 18 files changed, 114 insertions(+), 342 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentCreateDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListInput.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentUpdateDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/ContentDto.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/GetContentInput.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/IContentPublicAppService.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml index 885034b055..31267b61aa 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml @@ -8,7 +8,6 @@ @using Volo.CmsKit.GlobalFeatures @using Volo.CmsKit.Pages @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting -@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelection @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Tags @@ -31,11 +30,6 @@ - @if (GlobalFeatureManager.Instance.IsEnabled()) - { - @await Component.InvokeAsync(typeof(ContentViewComponent), new {entityType = "quote", entityId = "1"}) - } - @if (GlobalFeatureManager.Instance.IsEnabled()) { @await Component.InvokeAsync(typeof(TagViewComponent), new diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentCreateDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentCreateDto.cs deleted file mode 100644 index 6832d26bd3..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentCreateDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Validation; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Admin.Contents -{ - [Serializable] - public class ContentCreateDto - { - [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxEntityTypeLength))] - public string EntityType { get; set; } - - [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxEntityIdLength))] - public string EntityId { get; set; } - - [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] - public string Value { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentDto.cs deleted file mode 100644 index 8cfb2e2e7c..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Admin.Contents -{ - [Serializable] - public class ContentDto : EntityDto - { - public string EntityType { get; set; } - - public string EntityId { get; set; } - - public string Value { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs deleted file mode 100644 index ba44253ae9..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Admin.Contents -{ - [Serializable] - public class ContentGetListDto : EntityDto - { - public string EntityType { get; set; } - - public string EntityId { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListInput.cs deleted file mode 100644 index fbca53a7b9..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentGetListInput.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Admin.Contents -{ - [Serializable] - public class ContentGetListInput : PagedAndSortedResultRequestDto - { - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentUpdateDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentUpdateDto.cs deleted file mode 100644 index c59075cc8d..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/ContentUpdateDto.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Validation; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Admin.Contents -{ - [Serializable] - public class ContentUpdateDto - { - [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] - public string Value { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs deleted file mode 100644 index 52bd07aa86..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Contents/IContentAdminAppService.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; -using Volo.CmsKit.Admin.Contents; - -namespace Volo.CmsKit.Admin.Contents -{ - public interface IContentAdminAppService - : ICrudAppService< - ContentDto, - ContentGetListDto, - Guid, - ContentGetListInput, - ContentCreateDto, - ContentUpdateDto> - { - Task GetAsync(string entityType, string entityId); - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs deleted file mode 100644 index 4e3a56a8e2..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Contents/ContentAdminController.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using System; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.GlobalFeatures; -using Volo.CmsKit.Admin.Contents; -using Volo.CmsKit.GlobalFeatures; -using Volo.CmsKit.Permissions; - -namespace Volo.CmsKit.Admin.Contents -{ - [Authorize(CmsKitAdminPermissions.Contents.Default)] - [RequiresGlobalFeature(typeof(ContentsFeature))] - [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] - [Area("cms-kit")] - [Route("api/cms-kit-admin/contents")] - public class ContentAdminController : CmsKitAdminController, IContentAdminAppService - { - protected IContentAdminAppService ContentAdminAppService { get; } - - public ContentAdminController(IContentAdminAppService contentAdminAppService) - { - ContentAdminAppService = contentAdminAppService; - } - - [HttpPost] - [Authorize(CmsKitAdminPermissions.Contents.Create)] - public Task CreateAsync(ContentCreateDto input) - { - return ContentAdminAppService.CreateAsync(input); - } - - [HttpDelete("{id}")] - [Authorize(CmsKitAdminPermissions.Contents.Delete)] - public Task DeleteAsync(Guid id) - { - return ContentAdminAppService.DeleteAsync(id); - } - - [HttpGet("{id}")] - [Authorize(CmsKitAdminPermissions.Contents.Default)] - public Task GetAsync(Guid id) - { - return ContentAdminAppService.GetAsync(id); - } - - [HttpGet] - [Authorize(CmsKitAdminPermissions.Contents.Default)] - public Task> GetListAsync(ContentGetListInput input) - { - return ContentAdminAppService.GetListAsync(input); - } - - [HttpPut] - [Authorize(CmsKitAdminPermissions.Contents.Update)] - public Task UpdateAsync(Guid id, ContentUpdateDto input) - { - return ContentAdminAppService.UpdateAsync(id, input); - } - - [HttpGet] - [Route("{entityType}/{entityId}")] - [Authorize(CmsKitAdminPermissions.Contents.Default)] - public Task GetAsync(string entityType, string entityId) - { - return ContentAdminAppService.GetAsync(entityType, entityId); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml index c79ff8b72c..1b35e6c913 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml @@ -1,5 +1,9 @@ @page "{Id}" +@using System.Globalization +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor +@using Volo.Abp.AspNetCore.Mvc.UI.Packages.Uppy +@using Volo.CmsKit.Admin.Web.Bundles @using Volo.CmsKit.Admin.Web.Menus @using Volo.CmsKit.Admin.Web.Pages @@ -15,19 +19,38 @@ @section scripts { - + + + + + + +} + +@section styles { + + + } - - +
+ + + + + - + - - +
+
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs index c80714aa91..c21f8f587c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml.cs @@ -46,14 +46,17 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.Pages [AutoMap(typeof(UpdatePageInputDto), ReverseMap = true)] public class UpdatePageViewModel { - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] [Required] - [DynamicFormIgnore] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] public string Slug { get; set; } + + [HiddenInput] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxSlugLength))] + public string Content { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js index 3f8b971866..7b9cb10570 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -4,9 +4,6 @@ var $formUpdate = $('#form-page-update'); var $buttonSubmit = $('#button-page-update'); - var $pageContentInput = $('#ViewModel_Value'); - var $pageIdInput = $('#Id'); - var $contentIdInput = $('#ViewModel_Id'); $formUpdate.on('submit', function (e) { e.preventDefault(); @@ -17,7 +14,9 @@ $formUpdate.ajaxSubmit({ success: function (result) { - submitEntityContent(); + abp.notify.success(l('SuccessfullySaved')); + abp.ui.clearBusy(); + location.href = "/CmsKit/Pages/"; } }); } @@ -28,38 +27,83 @@ $formUpdate.submit(); }); - function submitEntityContent() { - - var contentId = $contentIdInput.val(); - var pageId = $pageIdInput.val(); - var contentValue = $pageContentInput.val(); - - if (contentId) { - volo.cmsKit.admin.contents.contentAdmin - .update(contentId, - { - value: contentValue - }) - .then(function (result) { - finishSaving(result); - }); - } - else { - volo.cmsKit.admin.contents.contentAdmin - .create({ - entityType: 'Page', - entityId: pageId, - value: contentValue - }) - .then(function (result) { - finishSaving(result); - }); - } + // ----------------------------------- + function getUppyHeaders() { + var headers = {}; + headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); + + return headers; } - function finishSaving(result) { - abp.notify.success(l('SuccessfullySaved')); - abp.ui.clearBusy(); - location.href = "/CmsKit/Pages/"; + var fileUploadUri = "/api/cms-kit-admin/media/page"; + var fileUriPrefix = "/api/cms-kit/media/"; + + var editorDataKey = "tuiEditor"; + + initAllEditors(); + + function initAllEditors() { + $('.content-editor').each(function (i, item) { + initEditor(item); + }); + } + + function initEditor(element) { + var $editorContainer = $(element); + var inputName = $editorContainer.data('input-id'); + var $editorInput = $('#' + inputName); + var initialValue = $editorInput.val(); + + var editor = $editorContainer.tuiEditor({ + usageStatistics: false, + useCommandShortcut: true, + initialValue: initialValue, + previewStyle: 'tab', + height: "25em", + minHeight: "25em", + initialEditType: initialValue ? 'wysiwyg' : 'markdown', + language: $editorContainer.data("language"), + hooks: { + addImageBlobHook: uploadFile, + }, + events: { + change: function (_val) { + $editorInput.val(editor.getHtml()); + $editorInput.trigger("change"); + } + } + }).data(editorDataKey); + } + + function uploadFile(blob, callback, source) { + var UPPY_OPTIONS = { + endpoint: fileUploadUri, + formData: true, + fieldName: "file", + method: "post", + headers: getUppyHeaders() + }; + + var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); + + UPPY.reset(); + + UPPY.addFile({ + id: "content-file", + name: blob.name, + type: blob.type, + data: blob, + }); + + UPPY.upload().then((result) => { + if (result.failed.length > 0) { + abp.message.error("File upload failed"); + } else { + var mediaDto = result.successful[0].response.body; + var fileUrl = (fileUriPrefix + mediaDto.id); + + callback(fileUrl, mediaDto.name); + } + }); } }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/ContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/ContentDto.cs deleted file mode 100644 index f11b4c8681..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/ContentDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Volo.CmsKit.Public.Contents -{ - [Serializable] - public class ContentDto : EntityDto - { - public string Value { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/GetContentInput.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/GetContentInput.cs deleted file mode 100644 index 26a127e105..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/GetContentInput.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Volo.CmsKit.Public.Contents -{ - [Serializable] - public class GetContentInput - { - public string EntityType { get; set; } - - public string EntityId { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/IContentPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/IContentPublicAppService.cs deleted file mode 100644 index df8b07cfce..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Contents/IContentPublicAppService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Threading.Tasks; -using Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Public.Contents -{ - public interface IContentPublicAppService - { - Task GetAsync(GetContentInput input); - } -} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs deleted file mode 100644 index 9ba368f03d..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Contents/ContentController.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp; -using Volo.Abp.GlobalFeatures; -using Volo.CmsKit.Contents; -using Volo.CmsKit.GlobalFeatures; - -namespace Volo.CmsKit.Public.Contents -{ - [RequiresGlobalFeature(typeof(ContentsFeature))] - [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] - [Area("cms-kit")] - [Route("api/cms-kit-public/contents")] - public class ContentController : CmsKitControllerBase, IContentPublicAppService - { - protected IContentPublicAppService ContentAppService { get; } - - public ContentController(IContentPublicAppService contentAppService) - { - ContentAppService = contentAppService; - } - - [HttpGet] - public virtual Task GetAsync(GetContentInput input) - { - return ContentAppService.GetAsync(input); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml index 76d1487861..0ed8987d72 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -1,6 +1,4 @@ @model Volo.CmsKit.Public.Blogs.BlogPostPublicDto -@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents -@using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.CmsKit.Localization @using Microsoft.Extensions.Localization diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs deleted file mode 100644 index 70baaf4436..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Domain.Entities; -using Volo.CmsKit.Public.Contents; -using Volo.CmsKit.Web.Contents; - -namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents -{ - [ViewComponent(Name = "CmsContent")] - public class ContentViewComponent : AbpViewComponent - { - private readonly IContentRenderer contentRenderer; - private readonly IContentPublicAppService contentAppService; - - public ContentViewComponent( - IContentRenderer contentRenderer, - IContentPublicAppService contentAppService) - { - this.contentRenderer = contentRenderer; - this.contentAppService = contentAppService; - } - - public virtual async Task InvokeAsync( - string entityType, - string entityId) - { - var content = string.Empty; - - try - { - var contentDto = await contentAppService.GetAsync(new GetContentInput - { - EntityId = entityId, - EntityType = entityType - }); - - content = contentDto.Value; - } - catch (EntityNotFoundException e) - { - // ContentDto can be null, we will render empty content. - } - - var viewModel = new ContentViewModel - { - Value = await contentRenderer.RenderAsync(content) - }; - - return View("~/Pages/CmsKit/Shared/Components/Contents/Default.cshtml", viewModel); - } - - public class ContentViewModel - { - public string Value { get; set; } - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml deleted file mode 100644 index 0f1ddedfe5..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents.ContentViewComponent.ContentViewModel - -@Html.Raw(Model.Value) From 3daf4a22f81dafd082234653df5674827bca23c9 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 13:41:33 +0300 Subject: [PATCH 015/101] update validator setting --- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js index 7b9cb10570..1dd4734150 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -5,6 +5,8 @@ var $formUpdate = $('#form-page-update'); var $buttonSubmit = $('#button-page-update'); + $formUpdate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; + $formUpdate.on('submit', function (e) { e.preventDefault(); From cf8986a13d4fcef4bd784c6754171c78ace6fac9 Mon Sep 17 00:00:00 2001 From: Zony Date: Tue, 2 Mar 2021 21:21:32 +0800 Subject: [PATCH 016/101] Improve the RabbitMQ documentation. --- docs/en/Background-Jobs-RabbitMq.md | 20 +++++++++++++++++ ...tributed-Event-Bus-RabbitMQ-Integration.md | 22 ++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/en/Background-Jobs-RabbitMq.md b/docs/en/Background-Jobs-RabbitMq.md index 2ee478ed17..16b8b0981a 100644 --- a/docs/en/Background-Jobs-RabbitMq.md +++ b/docs/en/Background-Jobs-RabbitMq.md @@ -66,6 +66,26 @@ Defining multiple connections is allowed. In this case, you can use different co } ```` +If you need to connect to the RabbitMQ cluster, you can use the `;` character to separate the host names. + +**Example: Connect to the RabbitMQ cluster** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + #### AbpRabbitMqOptions `AbpRabbitMqOptions` class can be used to configure the connection strings for the RabbitMQ. You can configure this options inside the `ConfigureServices` of your [module](Module-Development-Basics.md). diff --git a/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md b/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md index 9587a111bf..3d99e1e3cf 100644 --- a/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md +++ b/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md @@ -90,7 +90,7 @@ You can use any of the [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dot **Example: Specify the connection port** -````csharp +````json { "RabbitMQ": { "Connections": { @@ -103,6 +103,26 @@ You can use any of the [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dot } ```` +If you need to connect to the RabbitMQ cluster, you can use the `;` character to separate the host names. + +**Example: Connect to the RabbitMQ cluster** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + ### The Options Classes `AbpRabbitMqOptions` and `AbpRabbitMqEventBusOptions` classes can be used to configure the connection strings and event bus options for the RabbitMQ. From d43370e0fb3a12847f83aa3f0a1c2be7439eb75f Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 16:40:16 +0300 Subject: [PATCH 017/101] make url and rootNamespace optional for api config --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index b29f0d338d..da04384cab 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -21,12 +21,11 @@ export interface ApplicationInfo { export type ApiConfig = { [key: string]: string; url: string; -} & Partial<{ rootNamespace: string; -}>; +}; export interface Apis { - [key: string]: ApiConfig; + [key: string]: Partial; default: ApiConfig; } From 55fa6468744570e743cb1167509b1aba871a25ac Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 16:40:35 +0300 Subject: [PATCH 018/101] remove url from dev-app api configs --- npm/ng-packs/apps/dev-app/src/environments/environment.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/npm/ng-packs/apps/dev-app/src/environments/environment.ts b/npm/ng-packs/apps/dev-app/src/environments/environment.ts index 87ca8d1447..771698e394 100644 --- a/npm/ng-packs/apps/dev-app/src/environments/environment.ts +++ b/npm/ng-packs/apps/dev-app/src/environments/environment.ts @@ -23,23 +23,18 @@ export const environment = { rootNamespace: 'MyCompanyName.MyProjectName', }, AbpFeatureManagement: { - url: 'https://localhost:44305', rootNamespace: 'Volo.Abp', }, AbpPermissionManagement: { - url: 'https://localhost:44305', rootNamespace: 'Volo.Abp.PermissionManagement', }, AbpTenantManagement: { - url: 'https://localhost:44305', rootNamespace: 'Volo.Abp.TenantManagement', }, AbpIdentity: { - url: 'https://localhost:44305', rootNamespace: 'Volo.Abp', }, AbpSettingManagement: { - url: 'https://localhost:44305', rootNamespace: 'Volo.Abp.SettingManagement', }, }, From 3b633f631e818532853e2983eb003f1628ecfc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 2 Mar 2021 16:44:27 +0300 Subject: [PATCH 019/101] Static property must be initialized in static constructor. --- .../Configuration/AbpApiProxyScriptingOptions.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs index 21bc6783bb..76c7dc74f5 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs @@ -10,10 +10,8 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration public static Func PropertyNameGenerator { get; set; } - public AbpApiProxyScriptingOptions() + static AbpApiProxyScriptingOptions() { - Generators = new Dictionary(); - PropertyNameGenerator = propertyInfo => { var jsonPropertyNameAttribute = propertyInfo.GetSingleAttributeOrNull(true); @@ -33,5 +31,10 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration return null; }; } + + public AbpApiProxyScriptingOptions() + { + Generators = new Dictionary(); + } } } \ No newline at end of file From dc83964fe829ba7662cc8c499e0d4efec8e329c6 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 16:57:27 +0300 Subject: [PATCH 020/101] deprecate legacy object extensions types --- .../lib/models/internal/object-extensions.ts | 143 ------------------ 1 file changed, 143 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/internal/object-extensions.ts b/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/internal/object-extensions.ts index 448183b8a0..ea8a9dad8f 100644 --- a/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/internal/object-extensions.ts +++ b/npm/ng-packs/packages/theme-shared/extensions/src/lib/models/internal/object-extensions.ts @@ -106,146 +106,3 @@ export interface PropContributors { createForm: PropContributorCallbacks>; editForm: PropContributorCallbacks>; } - -/** - * @deprecated To be deleted in v4.2. - */ -export interface Config { - objectExtensions: Item; -} - -/** - * @deprecated Use ObjectExtensionsDto. To be deleted in v4.2. - */ -export interface Item { - modules: Modules; - enums: Enums; -} - -/** - * @deprecated Use Record. To be deleted in v4.2. - */ -export type Modules = Configuration; - -/** - * @deprecated Use ModuleExtensionDto. To be deleted in v4.2. - */ -export interface Module { - configuration: Configuration; - entities: Entities; -} - -/** - * @deprecated Use Record. To be deleted in v4.2. - */ -export type Entities = Configuration; - -/** - * @deprecated Use EntityExtensionDto. To be deleted in v4.2. - */ -export interface Entity { - configuration: Configuration; - properties: Properties; -} - -/** - * @deprecated Use Record. To be deleted in v4.2. - */ -export type Properties = Configuration; - -/** - * @deprecated Use ExtensionPropertyDto. To be deleted in v4.2. - */ -export interface Property { - type: string; - typeSimple: ePropType; - displayName: DisplayName | null; - api: Api; - ui: Ui; - attributes: Attribute[]; - configuration: Configuration; - defaultValue?: any; -} - -/** - * @deprecated Use LocalizableStringDto. To be deleted in v4.2. - */ -export interface DisplayName { - name: string; - resource: string; -} - -/** - * @deprecated Use ExtensionPropertyApiDto. To be deleted in v4.2. - */ -export interface Api { - onGet: ApiConfig; - onCreate: ApiConfig; - onUpdate: ApiConfig; -} - -/** - * @deprecated Use ExtensionPropertyApiCreateDto. To be deleted in v4.2. - */ -export interface ApiConfig { - isAvailable: boolean; -} - -/** - * @deprecated Use ExtensionPropertyUiDto. To be deleted in v4.2. - */ -export interface Ui { - onTable: UiPropConfig; - onCreateForm: UiFormConfig; - onEditForm: UiFormConfig; -} - -/** - * @deprecated Use ExtensionPropertyUiTableDto. To be deleted in v4.2. - */ -export interface UiPropConfig { - isSortable: boolean; - isVisible: boolean; -} - -/** - * @deprecated Use ExtensionPropertyUiFormDto. To be deleted in v4.2. - */ -export interface UiFormConfig { - isVisible: boolean; -} - -/** - * @deprecated Use ExtensionPropertyAttributeDto. To be deleted in v4.2. - */ -export interface Attribute { - typeSimple: string; - config: Configuration; -} - -/** - * @deprecated To be deleted in v4.2. - */ -export type Configuration = Record; - -/** - * @deprecated Use Record. To be deleted in v4.2. - */ -export type Enums = Record; - -/** - * @deprecated Use ExtensionEnumDto. To be deleted in v4.2. - */ -export interface Enum { - fields: EnumMember[]; - localizationResource?: string; - transformed?: any; -} - -/** - * @deprecated Use ExtensionEnumFieldDto. To be deleted in v4.2. - */ -export interface EnumMember { - name: string; - value: any; -} From bce5c1660dd94a16934afb6b482585b07951e245 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 17:00:45 +0300 Subject: [PATCH 021/101] make ApiConfig interface instead of type literal --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index da04384cab..dc5fab9ef7 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -18,11 +18,11 @@ export interface ApplicationInfo { logoUrl?: string; } -export type ApiConfig = { +export interface ApiConfig { [key: string]: string; url: string; rootNamespace: string; -}; +} export interface Apis { [key: string]: Partial; From 17ad81cbd9301f6f7ebcaf6130830ee862deef7e Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 17:03:33 +0300 Subject: [PATCH 022/101] CmsKit - Remove required permissions from AbpAuthorizationException --- .../Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs index 83d36431c8..9d4c109698 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminAppServiceBase.cs @@ -33,11 +33,7 @@ namespace Volo.CmsKit.Admin } } - var exception = new AbpAuthorizationException(); - - exception.Data[nameof(policies)] = policies; - - throw exception; + throw new AbpAuthorizationException(); } } } From d0a52b1b1e16a717c864e77f3b0a8522c53d587c Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 17:04:26 +0300 Subject: [PATCH 023/101] make rootNamespace optional again --- npm/ng-packs/packages/core/src/lib/models/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/models/environment.ts b/npm/ng-packs/packages/core/src/lib/models/environment.ts index dc5fab9ef7..46596685b0 100644 --- a/npm/ng-packs/packages/core/src/lib/models/environment.ts +++ b/npm/ng-packs/packages/core/src/lib/models/environment.ts @@ -21,7 +21,7 @@ export interface ApplicationInfo { export interface ApiConfig { [key: string]: string; url: string; - rootNamespace: string; + rootNamespace?: string; } export interface Apis { From 272361159d7ee4e0d7fb1b41cfddbf95a03fdc0f Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 2 Mar 2021 17:04:45 +0300 Subject: [PATCH 024/101] update environment service to handle optional urls --- .../src/lib/services/environment.service.ts | 9 +++--- .../src/lib/tests/environment.service.spec.ts | 31 +++++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/services/environment.service.ts b/npm/ng-packs/packages/core/src/lib/services/environment.service.ts index 2062294b7b..10d7664acb 100644 --- a/npm/ng-packs/packages/core/src/lib/services/environment.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/environment.service.ts @@ -4,6 +4,9 @@ import { map } from 'rxjs/operators'; import { Apis, Environment } from '../models/environment'; import { InternalStore } from '../utils/internal-store-utils'; +const mapToApiUrl = (key: string) => (apis: Apis) => + (apis[key] || apis.default).url || apis.default.url; + @Injectable({ providedIn: 'root' }) export class EnvironmentService { private readonly store = new InternalStore({} as Environment); @@ -21,13 +24,11 @@ export class EnvironmentService { } getApiUrl(key?: string) { - return (this.store.state.apis[key || 'default'] || this.store.state.apis.default).url; + return mapToApiUrl(key)(this.store.state.apis); } getApiUrl$(key?: string) { - return this.store - .sliceState(state => state.apis) - .pipe(map((apis: Apis) => (apis[key || 'default'] || apis.default).url)); + return this.store.sliceState(state => state.apis).pipe(map(mapToApiUrl(key))); } setState(environment: Environment) { diff --git a/npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts index fe9f50a546..95c2b58a6c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts @@ -1,3 +1,4 @@ +import { waitForAsync } from '@angular/core/testing'; import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { Environment } from '../models'; import { EnvironmentService } from '../services'; @@ -17,6 +18,7 @@ export const ENVIRONMENT_DATA = ({ other: { url: 'https://localhost:44306', }, + yetAnother: {}, }, localization: { defaultResourceName: 'MyProjectName', @@ -39,19 +41,28 @@ describe('ConfigState', () => { }); describe('#getEnvironment', () => { - it('should return ENVIRONMENT_DATA', () => { - expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA); - environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA)); - }); + it( + 'should return ENVIRONMENT_DATA', + waitForAsync(() => { + expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA); + environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA)); + }), + ); }); describe('#getApiUrl', () => { - it('should return api url', () => { - expect(environment.getApiUrl()).toEqual(ENVIRONMENT_DATA.apis.default.url); - environment - .getApiUrl$('other') - .subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url)); - }); + it( + 'should return api url', + waitForAsync(() => { + expect(environment.getApiUrl()).toEqual(ENVIRONMENT_DATA.apis.default.url); + environment + .getApiUrl$('other') + .subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url)); + environment + .getApiUrl$('yetAnother') + .subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.default.url)); + }), + ); }); // TODO: create permission.service.spec.ts From b7217ab9127be8184e32c718a01e39c406b56630 Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 2 Mar 2021 17:06:43 +0300 Subject: [PATCH 025/101] CmsKit - Add Create & Update policies to delete Media & Tags --- .../Admin/CmsKitAdminApplicationModule.cs | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index 95dbe44a04..17c242755e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -46,9 +46,21 @@ namespace Volo.CmsKit.Admin new TagEntityTypeDefiniton( BlogPostConsts.EntityType, LocalizableString.Create("BlogPost"), - new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, - new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, - new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update })); + createPolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update + }, + updatePolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update + }, + deletePolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update + })); } }); @@ -61,8 +73,17 @@ namespace Volo.CmsKit.Admin options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( BlogPostConsts.EntityType, - createPolicies: new[] { CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, - deletePolicies: new[] { CmsKitAdminPermissions.BlogPosts.Delete })); + createPolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update + }, + deletePolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update, + CmsKitAdminPermissions.BlogPosts.Delete + })); } if (GlobalFeatureManager.Instance.IsEnabled()) @@ -70,8 +91,17 @@ namespace Volo.CmsKit.Admin options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( PageConsts.EntityType, - createPolicies: new[] { CmsKitAdminPermissions.Pages.Create, CmsKitAdminPermissions.Pages.Update }, - deletePolicies: new[] { CmsKitAdminPermissions.Pages.Delete })); + createPolicies: new[] + { + CmsKitAdminPermissions.Pages.Create, + CmsKitAdminPermissions.Pages.Update + }, + deletePolicies: new[] + { + CmsKitAdminPermissions.Pages.Create, + CmsKitAdminPermissions.Pages.Update, + CmsKitAdminPermissions.Pages.Delete + })); } }); } From 12da9394e6932c972d50c6693da4bdc523ca98df Mon Sep 17 00:00:00 2001 From: Zony Date: Tue, 2 Mar 2021 22:47:03 +0800 Subject: [PATCH 026/101] Improve RabbitMQ Chinese documentation. --- ...tributed-Event-Bus-RabbitMQ-Integration.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md index 2a1810e309..ab7cb68bd7 100644 --- a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md +++ b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md @@ -103,6 +103,26 @@ } ```` +如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName。 + +**示例: 连接到 RabbitMQ 集群** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + ### 选项类 `AbpRabbitMqOptions` 和 `AbpRabbitMqEventBusOptions` 类用于配置RabbitMQ的连接字符串和事件总线选项. From 252f7c9a32c485d6c8014b76ba00b14710540c21 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 2 Mar 2021 17:48:59 +0300 Subject: [PATCH 027/101] Add missing localizations --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 6 ++++-- .../AbpIoLocalization/Admin/Localization/Resources/tr.json | 5 ++++- .../Community/Localization/Resources/en.json | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index c02e6e13de..0ada3327df 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -213,7 +213,9 @@ "Currency": "Currency", "Gateway": "Gateway", "State": "State", - "FailReason": "Fail reason" - + "FailReason": "Fail reason", + "ReIndexAllPosts": "ReIndex All Posts", + "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", + "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json index 1884b0025f..34ee392140 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json @@ -163,6 +163,9 @@ "Enum:ContentSource:2": "Video İçerik", "DeleteCoverImage": "Kapak Fotoğrafını Sil", "DeleteCoverImageConfirmationMessage": "Kapak fotoğrafını \"{0}\" isimli makale için silmek istediğinize emin misiniz?", - "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir" + "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir", + "ReIndexAllPosts": "Yeniden indeksle", + "ReIndexAllPostsConfirmationMessage": "Tüm gönderileri yeniden indeksleyeceğinizden emin misiniz?", + "SuccessfullyReIndexAllPosts": "Tüm gönderiler başarıyla yeniden indekslendi" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index 9c1e434ac1..9c5ae26f89 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -136,6 +136,8 @@ "GitHubUserNameValidationMessage": "Your Github username can not include whitespace, please be sure your Github username is correct.", "PersonalSiteUrlValidationMessage": "Your personal site URL can not include whitespace, please be sure your personal site URL is correct.", "TwitterUserNameValidationMessage": "Your Twitter username can not include whitespace, please be sure your Twitter username is correct.", - "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct." + "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct.", + "NoPostsFound": "No posts found!", + "SearchInPosts": "Search in posts..." } } From e4b7a6adc0473795140f250fb2843a60eba31158 Mon Sep 17 00:00:00 2001 From: Zony Date: Tue, 2 Mar 2021 22:48:48 +0800 Subject: [PATCH 028/101] Submit the `RabbitMQ Background Job Manager` Chinese document. --- docs/zh-Hans/Background-Jobs-RabbitMq.md | 154 ++++++++++++++++++++++- 1 file changed, 152 insertions(+), 2 deletions(-) diff --git a/docs/zh-Hans/Background-Jobs-RabbitMq.md b/docs/zh-Hans/Background-Jobs-RabbitMq.md index 979beec872..45c2978593 100644 --- a/docs/zh-Hans/Background-Jobs-RabbitMq.md +++ b/docs/zh-Hans/Background-Jobs-RabbitMq.md @@ -1,3 +1,153 @@ -# RabbitMQ Background Job Manager +# RabbitMQ 后台作业管理 -待添加 \ No newline at end of file +RabbitMQ 是一个标准的消息队列中间件,虽然它常用于消息传递/分布式事件,但也非常适合存储 FIFO(先进先出) 顺序的后台作业。 + +ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包,将使用 RabbitMQ 来执行后台作业。 + +> 参阅 [后台作业文档](Background-Jobs.md) 学习如何使用后台作业系统,本文只介绍了如何安装和配置 RabbitMQ 集成。 + +## 安装 + +使用 ABP CLI 将 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包添加到你的项目: + +- 如果之前没有安装过 [ABP CLI](https://docs.abp.io/en/abp/latest/CLI),请先安装它。 +- 跳转到待安装后台作业管理的项目目录中(包含 `.csproj` 文件的目录),打开终端管理器。 +- 执行 `abp add-package Volo.Abp.BackgroundJobs.RabbitMQ` 命令。 + +如果你想要手动安装,请先用 NuGet 包管理器安装 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包到指定项目,之后使在你的 [模块](Module-Development-Basics.md) 上面添加 `[DependsOn(typeof(AbpBackgroundJobsRabbitMqModule))]` 配置依赖。 + +## 配置 + +### 默认配置 + +默认配置将会使用标准端口和主机名(localhost)连接到 RabbitMQ 服务,**你不需要进行额外配置**。 + +### RabbitMQ 连接 + +你可以使用 ASP.NET Core 的 [标准配置系统](Configuration.md) 对 RabbitMQ 进行详细配置,比如 `appsettings.json` 或者是 [选项类](Options.md)。 + +#### 通过 `appsettings.json` 文件配置 + +这种方式是配置 RabbitMQ 连接最简单的方式,你可以使用其他的配置源(例如环境变量)。这些强大的功能都是由 [ASP.NET Core](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/) 提供的支持。 + +**示例: 配置默认的 RabbitMQ 连接** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123", + "Port": "5672" + } + } + } +} +``` + +你可以在配置文件使用所有 [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dotnet-client/api/RabbitMQ.Client.ConnectionFactory.html#properties) 的属性,关于这些属性的具体含义,可以查看 RabbitMQ 的 [官方文档](https://www.rabbitmq.com/dotnet-api-guide.html#exchanges-and-queues)。 + +目前我们允许定义多个连接,多连接的情况适用于不同的后台作业,具体配置信息可以参考下面的 RabbitMQ 后台作业配置说明。 + +**示例: 定义两个 RabbitMQ 连接** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123" + }, + "SecondConnection": { + "HostName": "321.321.321.321" + } + } + } +} +``` + +如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName。 + +**示例: 连接到 RabbitMQ 集群** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + +#### 使用选项类 + +`AbpRabbitMqOptions` 类型用于配置 RabbitMQ 的连接字符串,你可以在 [模块](Module-Development-Basics.md) 的 `ConfigureService` 方法中进行配置。 + +**示例: 配置 RabbitMQ 连接** + +```csharp +Configure(options => +{ + options.Connections.Default.UserName = "user"; + options.Connections.Default.Password = "pass"; + options.Connections.Default.HostName = "123.123.123.123"; + options.Connections.Default.Port = 5672; +}); +``` + +关于选项类,可以结合 `appsettings.json` 文件一起使用。针对同一个属性,在选项类里面对该值进行了设定,会覆盖掉 `appsettings.json` 的值。 + +### RabbitMQ 后台作业配置说明 + +#### 后台作业队列的名称 + +默认情况下,每个后台作业都会使用一个单独的队列,结合标准前缀和作业名称来构造一个完整的队列名称。默认的前缀为 `AbpBackgroundJobs`,所以有一个作业的名称是 `EmailSending` 的话,在 RabbitMQ 的队列名称就是 `AbpBackgroundJobs.EmailSending`。 + +> 在后台作业的参数类上,可以使用 `BackgroundJobName` 特性指定后台作业的名称。否则的话,后台作业的名称将会是后台作业类的全名(Full Name)(也包含命名空间)。 + +#### 后台作业使用的连接 + +默认情况下,后台作业都会使用 `Default` 作为默认连接。 + +#### 自定义 + +`AbpRabbitMqBackgroundJobOptions` 可以自定义队列名和作业使用的 RabbitMQ 连接。 + +**示例: ** + +```csharp +Configure(options => +{ + options.DefaultQueueNamePrefix = "my_app_jobs."; + options.JobQueues[typeof(EmailSendingArgs)] = + new JobQueueConfiguration( + typeof(EmailSendingArgs), + queueName: "my_app_jobs.emails", + connectionName: "SecondConnection" + ); +}); +``` + +- 这个示例将默认的队列名前缀设置为 `my_app_jobs.`,如果多个项目都使用的同一个 RabbitMQ 服务,设置不同的前缀可以避免执行其他项目的后台作业。 +- 这里还设置了 `EmailSendingArgs` 绑定的 RabbitMQ 连接。 + +`JobQueueConfiguration` 类的构造函数中,还有一些其他的可选参数。 + +- `queueName`: 指定后台作业对应的队列名称(全名)。 +- `connectionName`: 后台作业对应的 RabbitMQ 连接名称,默认是 `Default`。 +- `durable`: 可选参数,默认为 `true`。 +- `exclusive`: 可选参数,默认为 `false`。 +- `autoDelete`: 可选参数,默认为 `false`。 + +如果你想要更多地了解 `durable`、`exclusive`、`autoDelete` 的用法,请阅读 RabbitMQ 提供的文档。 + +## 参考 + +- [后台作业](Background-Jobs.md) \ No newline at end of file From 36097d2e402df345eaf16b98ae9a577f81612f13 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 18:06:30 +0300 Subject: [PATCH 029/101] PropertyNameGenerator moved to static class --- .../Modeling/PropertyApiDescriptionModel.cs | 2 +- .../AbpApiPropertyNameConfiguration.cs | 32 +++++++++++++++++++ .../AbpApiProxyScriptingOptions.cs | 25 --------------- 3 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index 678798ae39..8eb307c630 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Http.Modeling return new PropertyApiDescriptionModel { Name = propertyInfo.Name, - JsonName = AbpApiProxyScriptingOptions.PropertyNameGenerator.Invoke(propertyInfo), + JsonName = AbpApiPropertyNameConfiguration.PropertyNameGenerator.Invoke(propertyInfo), Type = ApiTypeNameHelper.GetTypeName(propertyInfo.PropertyType), TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(propertyInfo.PropertyType), IsRequired = propertyInfo.IsDefined(typeof(RequiredAttribute), true) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs new file mode 100644 index 0000000000..4320e9905f --- /dev/null +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs @@ -0,0 +1,32 @@ +using System; +using System.Reflection; + +namespace Volo.Abp.Http.ProxyScripting.Configuration +{ + public static class AbpApiPropertyNameConfiguration + { + public static Func PropertyNameGenerator { get; set; } + + static AbpApiPropertyNameConfiguration() + { + PropertyNameGenerator = propertyInfo => + { + var jsonPropertyNameAttribute = propertyInfo.GetSingleAttributeOrNull(true); + + if (jsonPropertyNameAttribute != null) + { + return jsonPropertyNameAttribute.Name; + } + + var jsonPropertyAttribute = propertyInfo.GetSingleAttributeOrNull(true); + + if (jsonPropertyAttribute != null) + { + return jsonPropertyAttribute.PropertyName; + } + + return null; + }; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs index 76c7dc74f5..e698d00416 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingOptions.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Reflection; namespace Volo.Abp.Http.ProxyScripting.Configuration { @@ -8,30 +7,6 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration { public IDictionary Generators { get; } - public static Func PropertyNameGenerator { get; set; } - - static AbpApiProxyScriptingOptions() - { - PropertyNameGenerator = propertyInfo => - { - var jsonPropertyNameAttribute = propertyInfo.GetSingleAttributeOrNull(true); - - if (jsonPropertyNameAttribute != null) - { - return jsonPropertyNameAttribute.Name; - } - - var jsonPropertyAttribute = propertyInfo.GetSingleAttributeOrNull(true); - - if (jsonPropertyAttribute != null) - { - return jsonPropertyAttribute.PropertyName; - } - - return null; - }; - } - public AbpApiProxyScriptingOptions() { Generators = new Dictionary(); From dc95eabf4305bace4a20100c82ae32f7f9325dfd Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 2 Mar 2021 18:10:29 +0300 Subject: [PATCH 030/101] rename configuration class name --- .../Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs | 2 +- ...eConfiguration.cs => AbpApiProxyScriptingConfiguration.cs} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/{AbpApiPropertyNameConfiguration.cs => AbpApiProxyScriptingConfiguration.cs} (89%) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index 8eb307c630..fc9f13edbc 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Http.Modeling return new PropertyApiDescriptionModel { Name = propertyInfo.Name, - JsonName = AbpApiPropertyNameConfiguration.PropertyNameGenerator.Invoke(propertyInfo), + JsonName = AbpApiProxyScriptingConfiguration.PropertyNameGenerator.Invoke(propertyInfo), Type = ApiTypeNameHelper.GetTypeName(propertyInfo.PropertyType), TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(propertyInfo.PropertyType), IsRequired = propertyInfo.IsDefined(typeof(RequiredAttribute), true) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs similarity index 89% rename from framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs rename to framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs index 4320e9905f..1f17d0d2cf 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiPropertyNameConfiguration.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs @@ -3,11 +3,11 @@ using System.Reflection; namespace Volo.Abp.Http.ProxyScripting.Configuration { - public static class AbpApiPropertyNameConfiguration + public static class AbpApiProxyScriptingConfiguration { public static Func PropertyNameGenerator { get; set; } - static AbpApiPropertyNameConfiguration() + static AbpApiProxyScriptingConfiguration() { PropertyNameGenerator = propertyInfo => { From e7f908e44a9fbef5b5ddccd1859baf7831c129de Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 3 Mar 2021 09:44:49 +0800 Subject: [PATCH 031/101] Update Background-Jobs-RabbitMq.md --- docs/zh-Hans/Background-Jobs-RabbitMq.md | 58 ++++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/zh-Hans/Background-Jobs-RabbitMq.md b/docs/zh-Hans/Background-Jobs-RabbitMq.md index 45c2978593..8fb5cc58b7 100644 --- a/docs/zh-Hans/Background-Jobs-RabbitMq.md +++ b/docs/zh-Hans/Background-Jobs-RabbitMq.md @@ -1,34 +1,34 @@ # RabbitMQ 后台作业管理 -RabbitMQ 是一个标准的消息队列中间件,虽然它常用于消息传递/分布式事件,但也非常适合存储 FIFO(先进先出) 顺序的后台作业。 +RabbitMQ 是一个标准的消息队列中间件,虽然它常用于消息传递/分布式事件,但也非常适合存储 FIFO(先进先出) 顺序的后台作业. -ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包,将使用 RabbitMQ 来执行后台作业。 +ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包,将使用 RabbitMQ 来执行后台作业. -> 参阅 [后台作业文档](Background-Jobs.md) 学习如何使用后台作业系统,本文只介绍了如何安装和配置 RabbitMQ 集成。 +> 参阅 [后台作业文档](Background-Jobs.md) 学习如何使用后台作业系统,本文只介绍了如何安装和配置 RabbitMQ 集成. ## 安装 使用 ABP CLI 将 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包添加到你的项目: -- 如果之前没有安装过 [ABP CLI](https://docs.abp.io/en/abp/latest/CLI),请先安装它。 -- 跳转到待安装后台作业管理的项目目录中(包含 `.csproj` 文件的目录),打开终端管理器。 -- 执行 `abp add-package Volo.Abp.BackgroundJobs.RabbitMQ` 命令。 +- 如果之前没有安装过 [ABP CLI](https://docs.abp.io/en/abp/latest/CLI),请先安装它. +- 跳转到待安装后台作业管理的项目目录中(包含 `.csproj` 文件的目录),打开终端管理器. +- 执行 `abp add-package Volo.Abp.BackgroundJobs.RabbitMQ` 命令. -如果你想要手动安装,请先用 NuGet 包管理器安装 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包到指定项目,之后使在你的 [模块](Module-Development-Basics.md) 上面添加 `[DependsOn(typeof(AbpBackgroundJobsRabbitMqModule))]` 配置依赖。 +如果你想要手动安装,请先用 NuGet 包管理器安装 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包到指定项目,之后使在你的 [模块](Module-Development-Basics.md) 上面添加 `[DependsOn(typeof(AbpBackgroundJobsRabbitMqModule))]` 配置依赖. ## 配置 ### 默认配置 -默认配置将会使用标准端口和主机名(localhost)连接到 RabbitMQ 服务,**你不需要进行额外配置**。 +默认配置将会使用标准端口和主机名(localhost)连接到 RabbitMQ 服务,**你不需要进行额外配置**. ### RabbitMQ 连接 -你可以使用 ASP.NET Core 的 [标准配置系统](Configuration.md) 对 RabbitMQ 进行详细配置,比如 `appsettings.json` 或者是 [选项类](Options.md)。 +你可以使用 ASP.NET Core 的 [标准配置系统](Configuration.md) 对 RabbitMQ 进行详细配置,比如 `appsettings.json` 或者是 [选项类](Options.md). #### 通过 `appsettings.json` 文件配置 -这种方式是配置 RabbitMQ 连接最简单的方式,你可以使用其他的配置源(例如环境变量)。这些强大的功能都是由 [ASP.NET Core](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/) 提供的支持。 +这种方式是配置 RabbitMQ 连接最简单的方式,你可以使用其他的配置源(例如环境变量).这些强大的功能都是由 [ASP.NET Core](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/) 提供的支持. **示例: 配置默认的 RabbitMQ 连接** @@ -45,9 +45,9 @@ ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org } ``` -你可以在配置文件使用所有 [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dotnet-client/api/RabbitMQ.Client.ConnectionFactory.html#properties) 的属性,关于这些属性的具体含义,可以查看 RabbitMQ 的 [官方文档](https://www.rabbitmq.com/dotnet-api-guide.html#exchanges-and-queues)。 +你可以在配置文件使用所有 [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dotnet-client/api/RabbitMQ.Client.ConnectionFactory.html#properties) 的属性,关于这些属性的具体含义,可以查看 RabbitMQ 的 [官方文档](https://www.rabbitmq.com/dotnet-api-guide.html#exchanges-and-queues). -目前我们允许定义多个连接,多连接的情况适用于不同的后台作业,具体配置信息可以参考下面的 RabbitMQ 后台作业配置说明。 +目前我们允许定义多个连接,多连接的情况适用于不同的后台作业,具体配置信息可以参考下面的 RabbitMQ 后台作业配置说明. **示例: 定义两个 RabbitMQ 连接** @@ -66,7 +66,7 @@ ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org } ``` -如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName。 +如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName. **示例: 连接到 RabbitMQ 集群** @@ -88,7 +88,7 @@ ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org #### 使用选项类 -`AbpRabbitMqOptions` 类型用于配置 RabbitMQ 的连接字符串,你可以在 [模块](Module-Development-Basics.md) 的 `ConfigureService` 方法中进行配置。 +`AbpRabbitMqOptions` 类型用于配置 RabbitMQ 的连接字符串,你可以在 [模块](Module-Development-Basics.md) 的 `ConfigureService` 方法中进行配置. **示例: 配置 RabbitMQ 连接** @@ -102,23 +102,23 @@ Configure(options => }); ``` -关于选项类,可以结合 `appsettings.json` 文件一起使用。针对同一个属性,在选项类里面对该值进行了设定,会覆盖掉 `appsettings.json` 的值。 +关于选项类,可以结合 `appsettings.json` 文件一起使用.针对同一个属性,在选项类里面对该值进行了设定,会覆盖掉 `appsettings.json` 的值. ### RabbitMQ 后台作业配置说明 #### 后台作业队列的名称 -默认情况下,每个后台作业都会使用一个单独的队列,结合标准前缀和作业名称来构造一个完整的队列名称。默认的前缀为 `AbpBackgroundJobs`,所以有一个作业的名称是 `EmailSending` 的话,在 RabbitMQ 的队列名称就是 `AbpBackgroundJobs.EmailSending`。 +默认情况下,每个后台作业都会使用一个单独的队列,结合标准前缀和作业名称来构造一个完整的队列名称.默认的前缀为 `AbpBackgroundJobs`,所以有一个作业的名称是 `EmailSending` 的话,在 RabbitMQ 的队列名称就是 `AbpBackgroundJobs.EmailSending`. -> 在后台作业的参数类上,可以使用 `BackgroundJobName` 特性指定后台作业的名称。否则的话,后台作业的名称将会是后台作业类的全名(Full Name)(也包含命名空间)。 +> 在后台作业的参数类上,可以使用 `BackgroundJobName` 特性指定后台作业的名称.否则的话,后台作业的名称将会是后台作业类的全名(也包含命名空间). #### 后台作业使用的连接 -默认情况下,后台作业都会使用 `Default` 作为默认连接。 +默认情况下,后台作业都会使用 `Default` 作为默认连接. #### 自定义 -`AbpRabbitMqBackgroundJobOptions` 可以自定义队列名和作业使用的 RabbitMQ 连接。 +`AbpRabbitMqBackgroundJobOptions` 可以自定义队列名和作业使用的 RabbitMQ 连接. **示例: ** @@ -135,19 +135,19 @@ Configure(options => }); ``` -- 这个示例将默认的队列名前缀设置为 `my_app_jobs.`,如果多个项目都使用的同一个 RabbitMQ 服务,设置不同的前缀可以避免执行其他项目的后台作业。 -- 这里还设置了 `EmailSendingArgs` 绑定的 RabbitMQ 连接。 +- 这个示例将默认的队列名前缀设置为 `my_app_jobs.`,如果多个项目都使用的同一个 RabbitMQ 服务,设置不同的前缀可以避免执行其他项目的后台作业. +- 这里还设置了 `EmailSendingArgs` 绑定的 RabbitMQ 连接. -`JobQueueConfiguration` 类的构造函数中,还有一些其他的可选参数。 +`JobQueueConfiguration` 类的构造函数中,还有一些其他的可选参数. -- `queueName`: 指定后台作业对应的队列名称(全名)。 -- `connectionName`: 后台作业对应的 RabbitMQ 连接名称,默认是 `Default`。 -- `durable`: 可选参数,默认为 `true`。 -- `exclusive`: 可选参数,默认为 `false`。 -- `autoDelete`: 可选参数,默认为 `false`。 +- `queueName`: 指定后台作业对应的队列名称(全名). +- `connectionName`: 后台作业对应的 RabbitMQ 连接名称,默认是 `Default`. +- `durable`: 可选参数,默认为 `true`. +- `exclusive`: 可选参数,默认为 `false`. +- `autoDelete`: 可选参数,默认为 `false`. -如果你想要更多地了解 `durable`、`exclusive`、`autoDelete` 的用法,请阅读 RabbitMQ 提供的文档。 +如果你想要更多地了解 `durable`,`exclusive`,`autoDelete` 的用法,请阅读 RabbitMQ 提供的文档. ## 参考 -- [后台作业](Background-Jobs.md) \ No newline at end of file +- [后台作业](Background-Jobs.md) From eb3b320f1ea76c1f98427bd40427d3e861a4f210 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 3 Mar 2021 09:45:09 +0800 Subject: [PATCH 032/101] Update Background-Jobs-RabbitMq.md --- docs/zh-Hans/Background-Jobs-RabbitMq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-Hans/Background-Jobs-RabbitMq.md b/docs/zh-Hans/Background-Jobs-RabbitMq.md index 8fb5cc58b7..0f9fb21d8a 100644 --- a/docs/zh-Hans/Background-Jobs-RabbitMq.md +++ b/docs/zh-Hans/Background-Jobs-RabbitMq.md @@ -148,6 +148,6 @@ Configure(options => 如果你想要更多地了解 `durable`,`exclusive`,`autoDelete` 的用法,请阅读 RabbitMQ 提供的文档. -## 参考 +## 另请参阅 - [后台作业](Background-Jobs.md) From 9ac0cb04d89b8fec2f0ff0ad4c2098ba5f6fc59c Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 3 Mar 2021 10:33:35 +0800 Subject: [PATCH 033/101] Use Index API to add or update documents --- .../Elastic/ElasticDocumentFullSearch.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs index 8e0a51324a..7160ca405b 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/FullSearch/Elastic/ElasticDocumentFullSearch.cs @@ -60,11 +60,6 @@ namespace Volo.Docs.Documents.FullSearch.Elastic var client = _clientProvider.GetClient(); - var existsResponse = await client.DocumentExistsAsync(DocumentPath.Id(document.Id), - x => x.Index(_options.IndexName), cancellationToken); - - HandleError(existsResponse); - var esDocument = new EsDocument { Id = NormalizeField(document.Id), @@ -76,17 +71,7 @@ namespace Volo.Docs.Documents.FullSearch.Elastic Version = NormalizeField(document.Version) }; - if (!existsResponse.Exists) - { - HandleError(await client.IndexAsync(esDocument, - x => x.Id(document.Id).Index(_options.IndexName), cancellationToken)); - } - else - { - HandleError(await client.UpdateAsync(DocumentPath.Id(document.Id), - x => x.Doc(esDocument).Index(_options.IndexName), cancellationToken)); - } - + await client.IndexAsync(esDocument , x=>x.Index(_options.IndexName), cancellationToken); } public virtual async Task DeleteAsync(Guid id, CancellationToken cancellationToken = default) @@ -94,7 +79,7 @@ namespace Volo.Docs.Documents.FullSearch.Elastic ValidateElasticSearchEnabled(); HandleError(await _clientProvider.GetClient() - .DeleteAsync(DocumentPath.Id(id), x => x.Index(_options.IndexName), cancellationToken)); + .DeleteAsync(DocumentPath.Id( NormalizeField(id)), x => x.Index(_options.IndexName), cancellationToken)); } public virtual async Task DeleteAllAsync(CancellationToken cancellationToken = default) From 706986715ca682008eeefea70df5cd2bb20517a7 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 3 Mar 2021 13:53:05 +0800 Subject: [PATCH 034/101] Check whether the controller implements the IRemoteService interface. Resolve #7920 --- .../AbpRemoteServiceApiDescriptionProvider.cs | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs index ae09573d60..1a017e9925 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs @@ -3,6 +3,7 @@ using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Options; @@ -19,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring public AbpRemoteServiceApiDescriptionProvider( IModelMetadataProvider modelMetadataProvider, - IOptions mvcOptionsAccessor, + IOptions mvcOptionsAccessor, IOptions optionsAccessor) { _modelMetadataProvider = modelMetadataProvider; @@ -41,7 +42,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring { foreach (var apiResponseType in GetApiResponseTypes()) { - foreach (var result in context.Results.Where(x => IsRemoteService(x.ActionDescriptor))) + foreach (var result in context.Results.Where(IsRemoteService)) { var actionProducesResponseTypeAttributes = ReflectionHelper.GetAttributesOfMemberOrDeclaringType( @@ -62,7 +63,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring foreach (var apiResponse in _options.SupportedResponseTypes) { apiResponse.ModelMetadata = _modelMetadataProvider.GetMetadataForType(apiResponse.Type); - + foreach (var responseTypeMetadataProvider in _mvcOptions.OutputFormatters.OfType()) { var formatterSupportedContentTypes = responseTypeMetadataProvider.GetSupportedContentTypes(null, apiResponse.Type); @@ -85,10 +86,29 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring return _options.SupportedResponseTypes; } - protected virtual bool IsRemoteService(ActionDescriptor actionDescriptor) + protected virtual bool IsRemoteService(ApiDescription actionDescriptor) { - var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(actionDescriptor.GetMethodInfo()); - return remoteServiceAttr != null && remoteServiceAttr.IsEnabled; + if (actionDescriptor.ActionDescriptor is ControllerActionDescriptor controllerActionDescriptor) + { + var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(controllerActionDescriptor.MethodInfo); + if (remoteServiceAttr != null && remoteServiceAttr.IsEnabled) + { + return true; + } + + remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(controllerActionDescriptor.ControllerTypeInfo); + if (remoteServiceAttr != null && remoteServiceAttr.IsEnabled) + { + return true; + } + + if (typeof(IRemoteService).IsAssignableFrom(controllerActionDescriptor.ControllerTypeInfo)) + { + return true; + } + } + + return false; } } -} \ No newline at end of file +} From bee8331660a592e791d24070a1bc0363b420842f Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Wed, 3 Mar 2021 10:56:59 +0300 Subject: [PATCH 035/101] add iis express caveat to service proxy document --- docs/en/UI/Angular/Service-Proxies.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/UI/Angular/Service-Proxies.md b/docs/en/UI/Angular/Service-Proxies.md index 8f6b1c4d60..3a10f1b6e8 100644 --- a/docs/en/UI/Angular/Service-Proxies.md +++ b/docs/en/UI/Angular/Service-Proxies.md @@ -137,3 +137,7 @@ export class BookComponent implements OnInit { ``` > Please [see this article](https://github.com/abpframework/abp/blob/dev/docs/en/Blog-Posts/2020-09-07%20Angular-Service-Proxies/POST.md) to learn more about service proxies. + +### Known Limitations + +When you run a project on Visual Studio using IIS Express as the web server, there will be no remote access to your endpoints. This is the default behavior of IIS Express since it explicitly protects you from the security risks of running over the network. However, that will cause the proxy generator to fail because it needs a response from the `/api/abp/api-definition` endpoint. You may serve your endpoints via Kestrel to avoid this. Running `dotnet run` in your command line (at your project folder) will do that for you. From f0a1e4a0507240ae5af46beb137bc95788c3ad3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 3 Mar 2021 11:42:51 +0300 Subject: [PATCH 036/101] Define ApplyDatabaseMigrationsEto. --- framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj | 2 +- .../Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs | 4 +++- .../Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs | 4 ++-- .../Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs diff --git a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj index cde2718a56..b1077c82da 100644 --- a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj +++ b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj @@ -15,7 +15,7 @@ - + diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs index bc3bc8e5dd..6690f855e4 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDataModule.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Volo.Abp.EventBus.Abstractions; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; using Volo.Abp.Uow; @@ -10,7 +11,8 @@ namespace Volo.Abp.Data { [DependsOn( typeof(AbpObjectExtendingModule), - typeof(AbpUnitOfWorkModule) + typeof(AbpUnitOfWorkModule), + typeof(AbpEventBusAbstractionsModule) )] public class AbpDataModule : AbpModule { diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs index 4f719a862a..33e545d10f 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs @@ -12,8 +12,8 @@ namespace Volo.Abp.Data public HashSet MappedConnections { get; } /// - /// Is this database used by tenants. Set this to true if this database - /// can't owned by tenants. + /// Is this database used by tenants. Set this to false if this database + /// can not owned by tenants. /// /// Default: true. /// diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs new file mode 100644 index 0000000000..be31bbe74f --- /dev/null +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.EventBus; + +namespace Volo.Abp.Data +{ + [Serializable] + [EventName("abp.data.apply_database_migrations")] + public class ApplyDatabaseMigrationsEto + { + public Guid? TenantId { get; set; } + + public string DatabaseName { get; set; } + } +} \ No newline at end of file From 9e1ae1171bc086e315d8051d5d909a833bfa4315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 3 Mar 2021 11:44:48 +0300 Subject: [PATCH 037/101] Inherit ApplyDatabaseMigrationsEto from EtoBase --- .../Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs index be31bbe74f..86c2003aad 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/ApplyDatabaseMigrationsEto.cs @@ -1,11 +1,12 @@ using System; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus; namespace Volo.Abp.Data { [Serializable] [EventName("abp.data.apply_database_migrations")] - public class ApplyDatabaseMigrationsEto + public class ApplyDatabaseMigrationsEto : EtoBase { public Guid? TenantId { get; set; } From f91cf9bc887b32167fab755e58a532949f57b171 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 3 Mar 2021 11:56:10 +0300 Subject: [PATCH 038/101] CmsKit - Fix JS url redirections --- .../cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs | 4 ++-- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js | 4 ++-- .../Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs index 4834670b3c..25dd69cd63 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs @@ -76,11 +76,11 @@ namespace Volo.CmsKit.Admin.Web options.Conventions.AddPageRoute("/CmsKit/Tags/Index", "/Cms/Tags"); options.Conventions.AddPageRoute("/CmsKit/Pages/Index", "/Cms/Pages"); options.Conventions.AddPageRoute("/CmsKit/Pages/Create", "/Cms/Pages/Create"); - options.Conventions.AddPageRoute("/CmsKit/Pages/Update", "/Cms/Pages/Update"); + options.Conventions.AddPageRoute("/CmsKit/Pages/Update", "/Cms/Pages/Update/{Id}"); options.Conventions.AddPageRoute("/CmsKit/Blogs/Index", "/Cms/Blogs"); options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Index", "/Cms/BlogPosts"); options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Create", "/Cms/BlogPosts/Create"); - options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Update", "/Cms/BlogPosts/Update"); + options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Update", "/Cms/BlogPosts/Update/{Id}"); options.Conventions.AddPageRoute("/CmsKit/Comments/Index", "/Cms/Comments"); options.Conventions.AddPageRoute("/CmsKit/Comments/Details", "/Cms/Details"); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js index 7302299419..e2f19079b7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/index.js @@ -27,7 +27,7 @@ $(function () { text: l('Edit'), visible: abp.auth.isGranted('CmsKit.Blogs.Update'), action: function (data) { - location.href = "/CmsKit/BlogPosts/Update/" + data.record.id + location.href = "BlogPosts/Update/" + data.record.id } }, { @@ -63,6 +63,6 @@ $(function () { $('#AbpContentToolbar button[name=CreateBlogPost]').on('click', function (e) { e.preventDefault(); - window.location.href = "/CmsKit/BlogPosts/Create" + window.location.href = "BlogPosts/Create" }); }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 14bfdc6f55..cfabca29ea 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -126,7 +126,7 @@ function finishSaving(result) { abp.notify.success(l('SuccessfullySaved')); abp.ui.clearBusy(); - location.href = "/CmsKit/BlogPosts/"; + location.href = ".."; } $titleClone.on('change paste keyup', function () { From 249dabdef4c979971e3a138cbfb0f64ccbea5206 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 3 Mar 2021 12:24:23 +0300 Subject: [PATCH 039/101] CmsKit - Make case-insensitive check for MediaDescriptorDefinitionStore --- .../Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs | 7 ++----- .../DefaultMediaDescriptorDefinitionStore.cs | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index 17c242755e..575e8950a6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -21,15 +21,12 @@ namespace Volo.CmsKit.Admin )] public class CmsKitAdminApplicationModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - ConfigureTagOptions(); - } - public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAutoMapperObjectMapper(); + ConfigureTagOptions(); + Configure(options => { options.AddMaps(validate: true); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs index 5a1553c3fc..752f921da7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/MediaDescriptors/DefaultMediaDescriptorDefinitionStore.cs @@ -29,7 +29,7 @@ namespace Volo.CmsKit.MediaDescriptors { Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); - var result = Options.EntityTypes.SingleOrDefault(x => x.EntityType == entityType) ?? + var result = Options.EntityTypes.SingleOrDefault(x => x.EntityType.Equals(entityType, StringComparison.InvariantCultureIgnoreCase)) ?? throw new EntityCantHaveMediaException(entityType); return Task.FromResult(result); @@ -39,7 +39,7 @@ namespace Volo.CmsKit.MediaDescriptors { Check.NotNullOrEmpty(entityType, nameof(entityType)); - var isDefined = Options.EntityTypes.Any(a => a.EntityType == entityType); + var isDefined = Options.EntityTypes.Any(a => a.EntityType.Equals(entityType, StringComparison.InvariantCultureIgnoreCase)); return Task.FromResult(isDefined); } From 42d3f7c4beecb745ba5eaacd46cb23ea7ee5d261 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 3 Mar 2021 12:29:08 +0300 Subject: [PATCH 040/101] CmsKit - Fix js redirection for BlogPost Update --- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index cfabca29ea..ee6da62f6a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -126,7 +126,7 @@ function finishSaving(result) { abp.notify.success(l('SuccessfullySaved')); abp.ui.clearBusy(); - location.href = ".."; + location.href = "../../BlogPosts"; } $titleClone.on('change paste keyup', function () { From b16fc75f29dc27d1da49a1525d225ab5acf4afe2 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 3 Mar 2021 14:30:49 +0300 Subject: [PATCH 041/101] CmsKit - Add EntityType configuration to Comments --- .../Admin/CmsKitAdminApplicationModule.cs | 51 ++++++++++------ .../Volo/CmsKit/CmsKitErrorCodes.cs | 5 ++ .../CmsKit/Localization/Resources/en.json | 3 +- .../CmsKit/Localization/Resources/tr.json | 1 + .../CmsKit/Comments/CmsKitCommentOptions.cs | 11 ++++ .../Volo/CmsKit/Comments/Comment.cs | 2 +- .../Comments/CommentEntityTypeDefinition.cs | 21 +++++++ .../Volo/CmsKit/Comments/CommentManager.cs | 42 +++++++++++++ ...DefaultCommentEntityTypeDefinitionStore.cs | 41 +++++++++++++ .../Comments/EntityNotCommentableException.cs | 26 ++++++++ .../ICommentEntityTypeDefinitionStore.cs | 17 ++++++ .../Comments/CommentPublicAppService.cs | 16 +++-- .../Comments/CommentManager_Test.cs | 59 +++++++++++++++++++ .../CmsKitDataSeedContributor.cs | 14 +++-- 14 files changed, 277 insertions(+), 32 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CmsKitCommentOptions.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentEntityTypeDefinition.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/DefaultCommentEntityTypeDefinitionStore.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentEntityTypeDefinitionStore.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Comments/CommentManager_Test.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index 575e8950a6..ec926999f9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -5,6 +5,7 @@ using Volo.Abp.GlobalFeatures; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.CmsKit.Blogs; +using Volo.CmsKit.Comments; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Localization; using Volo.CmsKit.MediaDescriptors; @@ -43,20 +44,20 @@ namespace Volo.CmsKit.Admin new TagEntityTypeDefiniton( BlogPostConsts.EntityType, LocalizableString.Create("BlogPost"), - createPolicies: new[] + createPolicies: new[] { - CmsKitAdminPermissions.BlogPosts.Create, - CmsKitAdminPermissions.BlogPosts.Update + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update }, - updatePolicies: new[] - { - CmsKitAdminPermissions.BlogPosts.Create, - CmsKitAdminPermissions.BlogPosts.Update + updatePolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update }, - deletePolicies: new[] - { - CmsKitAdminPermissions.BlogPosts.Create, - CmsKitAdminPermissions.BlogPosts.Update + deletePolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, + CmsKitAdminPermissions.BlogPosts.Update })); } }); @@ -70,9 +71,9 @@ namespace Volo.CmsKit.Admin options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( BlogPostConsts.EntityType, - createPolicies: new[] - { - CmsKitAdminPermissions.BlogPosts.Create, + createPolicies: new[] + { + CmsKitAdminPermissions.BlogPosts.Create, CmsKitAdminPermissions.BlogPosts.Update }, deletePolicies: new[] @@ -88,20 +89,36 @@ namespace Volo.CmsKit.Admin options.EntityTypes.AddIfNotContains( new MediaDescriptorDefinition( PageConsts.EntityType, - createPolicies: new[] + createPolicies: new[] { CmsKitAdminPermissions.Pages.Create, - CmsKitAdminPermissions.Pages.Update + CmsKitAdminPermissions.Pages.Update }, deletePolicies: new[] { CmsKitAdminPermissions.Pages.Create, CmsKitAdminPermissions.Pages.Update, - CmsKitAdminPermissions.Pages.Delete + CmsKitAdminPermissions.Pages.Delete })); } }); } } + + private void ConfigureCommentOptions() + { + if (GlobalFeatureManager.Instance.IsEnabled()) + { + Configure(options => + { + if (GlobalFeatureManager.Instance.IsEnabled()) + { + options.EntityTypes.AddIfNotContains( + new CommentEntityTypeDefinition(BlogPostConsts.EntityType)); + + } + }); + } + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs index b358672a1a..064c504fb4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/CmsKitErrorCodes.cs @@ -24,6 +24,11 @@ { public const string SlugAlreadyExist = "CmsKit:BlogPost:0001"; } + + public static class Comments + { + public const string EntityNotCommentable = "CmsKit:Comments:0001"; + } public static class MediaDescriptors { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 1107d5e5db..5ae38566af 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -17,10 +17,11 @@ "CmsKit:0003": "The entity {0} is not taggable.", "CmsKit:Blog:0001": "The given slug ({Slug}) already exists!", "CmsKit:BlogPost:0001": "The given slug already exists!", + "CmsKit:Comments:0001": "The entity {0} is not commentable.", "CmsKit:Media:0001": "'{Name}' is not a valid media name.", + "CmsKit:Media:0002": "The entity can't have media.", "CmsKit:Page:0001": "The given url ({0}) already exists.", "CmsKit:Tag:0002": "The entity is not taggable!", - "CmsKit:Media:0002": "The entity can't have media.", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display.", "CommentDeletionConfirmationMessage": "This comment and all replies will be deleted!", "Comments": "Comments", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index f41639325a..2571d7ad96 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -13,6 +13,7 @@ "CmsKit.Ratings": "Puanlama", "CmsKit.Reactions": "Tepkiler", "CmsKit.Tags": "Etiketler", + "CmsKit:Comments:0001": "{0} ögesi yorumlanabilir değil.", "CmsKit:0002": "İçerik zaten mevcut!", "CmsKit:0003": "{0} ögesi etiketlenebilir değil.", "CmsKit:BlogPost:0001": "Aynı url etiketi zaten mevcut.", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CmsKitCommentOptions.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CmsKitCommentOptions.cs new file mode 100644 index 0000000000..7e1dcbc1dd --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CmsKitCommentOptions.cs @@ -0,0 +1,11 @@ +using JetBrains.Annotations; +using System.Collections.Generic; + +namespace Volo.CmsKit.Comments +{ + public class CmsKitCommentOptions + { + [NotNull] + public List EntityTypes { get; } = new List(); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs index 0d2a7e7a18..ea37b5ebdc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/Comment.cs @@ -28,7 +28,7 @@ namespace Volo.CmsKit.Comments } - public Comment( + internal Comment( Guid id, [NotNull] string entityType, [NotNull] string entityId, diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentEntityTypeDefinition.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentEntityTypeDefinition.cs new file mode 100644 index 0000000000..fe0f8ebda3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentEntityTypeDefinition.cs @@ -0,0 +1,21 @@ +using JetBrains.Annotations; +using System; +using Volo.Abp; + +namespace Volo.CmsKit.Comments +{ + public class CommentEntityTypeDefinition : IEquatable + { + public CommentEntityTypeDefinition([NotNull] string entityType) + { + EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType)); + } + + public string EntityType { get; } + + public bool Equals(CommentEntityTypeDefinition other) + { + return EntityType == other?.EntityType; + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs new file mode 100644 index 0000000000..59a3664e09 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs @@ -0,0 +1,42 @@ +using JetBrains.Annotations; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Services; +using Volo.CmsKit.Users; + +namespace Volo.CmsKit.Comments +{ + public class CommentManager : DomainService + { + protected ICommentEntityTypeDefinitionStore DefinitionStore { get; } + + public CommentManager(ICommentEntityTypeDefinitionStore definitionStore) + { + DefinitionStore = definitionStore; + } + + public virtual async Task CreateAsync([NotNull] CmsUser creator, + [NotNull] string entityType, + [NotNull] string entityId, + [NotNull] string text, + [CanBeNull] Guid? repliedCommentId = null) + { + Check.NotNull(creator, nameof(creator)); + + if (!await DefinitionStore.IsDefinedAsync(entityType)) + { + throw new EntityNotCommentableException(entityType); + } + + return new Comment( + GuidGenerator.Create(), + entityType, + entityId, + text, + repliedCommentId, + creator.Id, + CurrentTenant.Id); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/DefaultCommentEntityTypeDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/DefaultCommentEntityTypeDefinitionStore.cs new file mode 100644 index 0000000000..bbb1b19aee --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/DefaultCommentEntityTypeDefinitionStore.cs @@ -0,0 +1,41 @@ +using JetBrains.Annotations; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.DependencyInjection; + +namespace Volo.CmsKit.Comments +{ + public class DefaultCommentEntityTypeDefinitionStore : ICommentEntityTypeDefinitionStore, ITransientDependency + { + protected CmsKitCommentOptions Options { get; } + + public DefaultCommentEntityTypeDefinitionStore(IOptions options) + { + Options = options.Value; + } + + public virtual Task GetDefinitionAsync([NotNull] string entityType) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + var result = Options.EntityTypes.SingleOrDefault(x => x.EntityType.Equals(entityType, StringComparison.InvariantCultureIgnoreCase)) ?? + throw new EntityNotCommentableException(entityType); + + return Task.FromResult(result); + } + + public virtual Task IsDefinedAsync([NotNull] string entityType) + { + Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); + + var isDefined = Options.EntityTypes.Any(x => x.EntityType == entityType); + + return Task.FromResult(isDefined); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs new file mode 100644 index 0000000000..12c3c872fc --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; + +namespace Volo.CmsKit.Comments +{ + public class EntityNotCommentableException : BusinessException + { + public EntityNotCommentableException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) + { + } + + public EntityNotCommentableException(string entityType) + { + Code = CmsKitErrorCodes.Comments.EntityNotCommentable; + EntityType = entityType; + WithData(nameof(EntityType), EntityType); + } + + public string EntityType { get; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentEntityTypeDefinitionStore.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentEntityTypeDefinitionStore.cs new file mode 100644 index 0000000000..315b7f878f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/ICommentEntityTypeDefinitionStore.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Comments; + +namespace Volo.CmsKit.Comments +{ + public interface ICommentEntityTypeDefinitionStore + { + Task GetDefinitionAsync([NotNull] string entityType); + + Task IsDefinedAsync([NotNull] string entityType); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs index f283473f95..d5dd555b71 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs @@ -21,20 +21,20 @@ namespace Volo.CmsKit.Public.Comments protected ICommentRepository CommentRepository { get; } protected ICmsUserLookupService CmsUserLookupService { get; } public IDistributedEventBus DistributedEventBus { get; } - public IUnitOfWorkManager UnitOfWorkManager { get; } + protected CommentManager CommentManager { get; } public CommentPublicAppService( ICommentRepository commentRepository, ICmsUserLookupService cmsUserLookupService, IDistributedEventBus distributedEventBus, - IUnitOfWorkManager unitOfWorkManager, - IOptions cmsKitOptions) + IOptions cmsKitOptions, + CommentManager commentManager) { CmsKitOptions = cmsKitOptions.Value; CommentRepository = commentRepository; CmsUserLookupService = cmsUserLookupService; DistributedEventBus = distributedEventBus; - UnitOfWorkManager = unitOfWorkManager; + CommentManager = commentManager; } public virtual async Task> GetListAsync(string entityType, string entityId) @@ -58,14 +58,12 @@ namespace Volo.CmsKit.Public.Comments } var comment = await CommentRepository.InsertAsync( - new Comment( - GuidGenerator.Create(), + await CommentManager.CreateAsync( + user, entityType, entityId, input.Text, - input.RepliedCommentId, - user.Id, - CurrentTenant.Id + input.RepliedCommentId ) ); diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Comments/CommentManager_Test.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Comments/CommentManager_Test.cs new file mode 100644 index 0000000000..5065ec9c06 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Comments/CommentManager_Test.cs @@ -0,0 +1,59 @@ +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Users; +using Xunit; + +namespace Volo.CmsKit.Comments +{ + public class CommentManager_Test : CmsKitDomainTestBase + { + private readonly CommentManager commentManager; + private readonly CmsKitTestData testData; + private readonly ICmsUserRepository userRepository; + + public CommentManager_Test() + { + commentManager = GetRequiredService(); + testData = GetRequiredService(); + userRepository = GetRequiredService(); + } + + [Fact] + public async Task CreateAsync_ShouldWorkProperly_WithCorrectData() + { + var creator = await userRepository.GetAsync(testData.User1Id); + + var text = "Thank you for the article. It's awesome"; + + var comment = await commentManager.CreateAsync(creator, testData.EntityType1, testData.EntityId1, text); + + comment.Id.ShouldNotBe(Guid.Empty); + comment.CreatorId.ShouldBe(creator.Id); + comment.EntityType.ShouldBe(testData.EntityType1); + comment.EntityId.ShouldBe(testData.EntityId1); + comment.Text.ShouldBe(text); + } + + [Fact] + public async Task CreateAsync_ShouldThrowException_WithNotConfiguredEntityType() + { + var creator = await userRepository.GetAsync(testData.User1Id); + var notConfiguredEntityType = "Some.New.Entity"; + var text = "Thank you for the article. It's awesome"; + + var exception = await Should.ThrowAsync(async () => + await commentManager.CreateAsync( + creator, + notConfiguredEntityType, + testData.EntityId1, + text)); + + exception.ShouldNotBeNull(); + exception.EntityType.ShouldBe(notConfiguredEntityType); + } + } +} diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index d218f7e93d..c4fc8de603 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -45,6 +45,7 @@ namespace Volo.CmsKit private readonly IBlobContainer _mediaBlobContainer; private readonly BlogManager _blogManager; private readonly IOptions _mediaOptions; + private readonly IOptions _commentsOptions; public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, @@ -64,11 +65,12 @@ namespace Volo.CmsKit IBlogFeatureRepository blogFeatureRepository, EntityTagManager entityTagManager, IOptions options, - IOptions tagOptions, - IMediaDescriptorRepository mediaDescriptorRepository, - IBlobContainer mediaBlobContainer, + IOptions tagOptions, + IMediaDescriptorRepository mediaDescriptorRepository, + IBlobContainer mediaBlobContainer, BlogManager blogManager, - IOptions cmsMediaOptions) + IOptions cmsMediaOptions, + IOptions commentsOptions) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -92,6 +94,7 @@ namespace Volo.CmsKit _mediaBlobContainer = mediaBlobContainer; _blogManager = blogManager; _mediaOptions = cmsMediaOptions; + _commentsOptions = commentsOptions; } public async Task SeedAsync(DataSeedContext context) @@ -134,6 +137,9 @@ namespace Volo.CmsKit createPolicies: new[] { "SomeCreatePolicy" }, deletePolicies: new[] { "SomeDeletePolicy" })); + _commentsOptions.Value.EntityTypes.Add( + new CommentEntityTypeDefinition(_cmsKitTestData.EntityType1)); + return Task.CompletedTask; } From c40093dffd26bb4afed698e448947334264378b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 3 Mar 2021 14:33:03 +0300 Subject: [PATCH 042/101] Added AbpAuthorizationServiceExtensions.IsGrantedAnyAsync --- .../AbpAuthorizationServiceExtensions.cs | 17 +++++++++++++++++ .../Volo/Abp/Data/AbpDatabaseInfo.cs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs index bb820c3a83..133209f30a 100644 --- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs +++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs @@ -65,6 +65,23 @@ namespace Microsoft.AspNetCore.Authorization { return (await authorizationService.AuthorizeAsync(policyName)).Succeeded; } + + public static async Task IsGrantedAnyAsync( + this IAuthorizationService authorizationService, + params string[] policyNames) + { + Check.NotNullOrEmpty(policyNames, nameof(policyNames)); + + foreach (var policyName in policyNames) + { + if ((await authorizationService.AuthorizeAsync(policyName)).Succeeded) + { + return true; + } + } + + return false; + } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) { diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs index 33e545d10f..bcd08718cb 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpDatabaseInfo.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Data { public class AbpDatabaseInfo { - public string DatabaseName { get; set; } + public string DatabaseName { get; } /// /// List of connection names mapped to this database. From eebd5c0b3294d4d0945e7e4a7b3ecf4748122f99 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 4 Mar 2021 14:03:39 +0800 Subject: [PATCH 043/101] Add UpdateNuGetConfigStep to get source command --- .../Building/ModuleProjectBuildPipelineBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs index 9b66f17834..d4a74d9364 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs @@ -1,4 +1,5 @@ using Volo.Abp.Cli.ProjectBuilding.Building.Steps; +using Volo.Abp.Cli.ProjectBuilding.Templates; namespace Volo.Abp.Cli.ProjectBuilding.Building { @@ -12,6 +13,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building pipeline.Steps.Add(new ProjectReferenceReplaceStep()); pipeline.Steps.Add(new ReplaceCommonPropsStep()); pipeline.Steps.Add(new ReplaceConfigureAwaitPropsStep()); + pipeline.Steps.Add(new UpdateNuGetConfigStep("/NuGet.Config")); pipeline.Steps.Add(new CreateProjectResultZipStep()); return pipeline; From e564e338a2a4b0fa45d17932f6533dfdff462f59 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 09:26:08 +0300 Subject: [PATCH 044/101] CmsKit - Add missing configuration to CmsKitAdminApplicationModule --- .../Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs index ec926999f9..5eaf3dae28 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/CmsKitAdminApplicationModule.cs @@ -28,6 +28,8 @@ namespace Volo.CmsKit.Admin ConfigureTagOptions(); + ConfigureCommentOptions(); + Configure(options => { options.AddMaps(validate: true); From f5f4f5f371673642b6db96d0b4e019fa49e1a922 Mon Sep 17 00:00:00 2001 From: EngincanV Date: Thu, 4 Mar 2021 10:28:25 +0300 Subject: [PATCH 045/101] Blogging: Cache blog posts --- .../Volo/Blogging/Posts/PostAppService.cs | 128 +++++++++++------- 1 file changed, 79 insertions(+), 49 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 70007a0c56..07d22d3385 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -4,6 +4,8 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Caching.Distributed; +using Volo.Abp.Caching; using Volo.Blogging.Comments; using Volo.Blogging.Tagging; using Volo.Blogging.Tagging.Dtos; @@ -18,71 +20,41 @@ namespace Volo.Blogging.Posts private readonly IPostRepository _postRepository; private readonly ITagRepository _tagRepository; private readonly ICommentRepository _commentRepository; + private readonly IDistributedCache> _postsCache; - public PostAppService(IPostRepository postRepository, ITagRepository tagRepository, ICommentRepository commentRepository, IBlogUserLookupService userLookupService) + public PostAppService(IPostRepository postRepository, ITagRepository tagRepository, ICommentRepository commentRepository, IBlogUserLookupService userLookupService, IDistributedCache> postsCache) { UserLookupService = userLookupService; _postRepository = postRepository; _tagRepository = tagRepository; _commentRepository = commentRepository; + _postsCache = postsCache; } - + public async Task> GetListByBlogIdAndTagName(Guid id, string tagName) { - var posts = await _postRepository.GetPostsByBlogId(id); - var tag = tagName.IsNullOrWhiteSpace() ? null : await _tagRepository.FindByNameAsync(id, tagName); - var userDictionary = new Dictionary(); - var postDtos = new List(ObjectMapper.Map, List>(posts)); - - foreach (var postDto in postDtos) - { - postDto.Tags = await GetTagsOfPost(postDto.Id); - } - - if (tag != null) - { - postDtos = await FilterPostsByTag(postDtos, tag); - } - - foreach (var postDto in postDtos) - { - if (postDto.CreatorId.HasValue) + var cacheKey = id.ToString() + "-" + tagName; + + return await _postsCache.GetOrAddAsync( + cacheKey, + async () => await GetPostsByBlogIdAndTagName(id, tagName), + () => new DistributedCacheEntryOptions { - if (!userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); - if (creatorUser != null) - { - userDictionary[creatorUser.Id] = ObjectMapper.Map(creatorUser); - } - } - - if (userDictionary.ContainsKey(postDto.CreatorId.Value)) - { - postDto.Writer = userDictionary[(Guid)postDto.CreatorId]; - } + AbsoluteExpiration = DateTimeOffset.Now.AddHours(6) } - } - - return new ListResultDto(postDtos); + ); } - + public async Task> GetTimeOrderedListAsync(Guid blogId) { - var posts = await _postRepository.GetOrderedList(blogId); - - var postDtos = new List(ObjectMapper.Map, List>(posts)); - - foreach (var postDto in postDtos) - { - var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); - if (creatorUser != null) + return await _postsCache.GetOrAddAsync( + blogId.ToString(), + async () => await GetTimeOrderedPostsAsync(blogId), + () => new DistributedCacheEntryOptions { - postDto.Writer = ObjectMapper.Map(creatorUser); + AbsoluteExpiration = DateTimeOffset.Now.AddHours(6) } - } - - return new ListResultDto(postDtos); + ); } public async Task GetForReadingAsync(GetPostInput input) @@ -185,6 +157,64 @@ namespace Volo.Blogging.Posts return ObjectMapper.Map(post); } + private async Task> GetPostsByBlogIdAndTagName(Guid id, string tagName) + { + var posts = await _postRepository.GetPostsByBlogId(id); + var tag = tagName.IsNullOrWhiteSpace() ? null : await _tagRepository.FindByNameAsync(id, tagName); + var userDictionary = new Dictionary(); + var postDtos = new List(ObjectMapper.Map, List>(posts)); + + foreach (var postDto in postDtos) + { + postDto.Tags = await GetTagsOfPost(postDto.Id); + } + + if (tag != null) + { + postDtos = await FilterPostsByTag(postDtos, tag); + } + + foreach (var postDto in postDtos) + { + if (postDto.CreatorId.HasValue) + { + if (!userDictionary.ContainsKey(postDto.CreatorId.Value)) + { + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + userDictionary[creatorUser.Id] = ObjectMapper.Map(creatorUser); + } + } + + if (userDictionary.ContainsKey(postDto.CreatorId.Value)) + { + postDto.Writer = userDictionary[(Guid)postDto.CreatorId]; + } + } + } + + return new ListResultDto(postDtos); + } + + private async Task> GetTimeOrderedPostsAsync(Guid blogId) + { + var posts = await _postRepository.GetOrderedList(blogId); + + var postDtos = new List(ObjectMapper.Map, List>(posts)); + + foreach (var postDto in postDtos) + { + var creatorUser = await UserLookupService.FindByIdAsync(postDto.CreatorId.Value); + if (creatorUser != null) + { + postDto.Writer = ObjectMapper.Map(creatorUser); + } + } + + return new ListResultDto(postDtos); + } + private async Task RenameUrlIfItAlreadyExistAsync(Guid blogId, string url, Post existingPost = null) { if (await _postRepository.IsPostUrlInUseAsync(blogId, url, existingPost?.Id)) From 92d3e6800bf9cec370fcdad08baecb1f8a15a225 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 4 Mar 2021 15:37:41 +0800 Subject: [PATCH 046/101] Make wpf template logger work --- .../MyCompanyName.MyProjectName/App.xaml.cs | 43 +++++++++---------- .../MainWindow.xaml.cs | 12 ------ .../MyCompanyName.MyProjectName.csproj | 2 +- 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/templates/wpf/src/MyCompanyName.MyProjectName/App.xaml.cs b/templates/wpf/src/MyCompanyName.MyProjectName/App.xaml.cs index 6ab1bd8c86..686cb5cba1 100644 --- a/templates/wpf/src/MyCompanyName.MyProjectName/App.xaml.cs +++ b/templates/wpf/src/MyCompanyName.MyProjectName/App.xaml.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; using System.Windows; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -22,19 +17,6 @@ namespace MyCompanyName.MyProjectName private readonly IAbpApplicationWithExternalServiceProvider _application; public App() - { - _host = Host - .CreateDefaultBuilder(null) - .UseAutofac() - .UseSerilog() - .ConfigureServices((hostContext, services) => - { - services.AddApplication(); - }).Build(); - _application = _host.Services.GetService(); - } - - protected async override void OnStartup(StartupEventArgs e) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -47,6 +29,12 @@ namespace MyCompanyName.MyProjectName .WriteTo.Async(c => c.File("Logs/logs.txt")) .CreateLogger(); + _host = CreateHostBuilder(); + _application = _host.Services.GetService(); + } + + protected override async void OnStartup(StartupEventArgs e) + { try { Log.Information("Starting WPF host."); @@ -60,22 +48,31 @@ namespace MyCompanyName.MyProjectName { Log.Fatal(ex, "Host terminated unexpectedly!"); } - finally - { - Log.CloseAndFlush(); - } } - protected async override void OnExit(ExitEventArgs e) + protected override async void OnExit(ExitEventArgs e) { _application.Shutdown(); await _host.StopAsync(); _host.Dispose(); + Log.CloseAndFlush(); } private void Initialize(IServiceProvider serviceProvider) { _application.Initialize(serviceProvider); } + + private IHost CreateHostBuilder() + { + return Host + .CreateDefaultBuilder(null) + .UseAutofac() + .UseSerilog() + .ConfigureServices((hostContext, services) => + { + services.AddApplication(); + }).Build(); + } } } diff --git a/templates/wpf/src/MyCompanyName.MyProjectName/MainWindow.xaml.cs b/templates/wpf/src/MyCompanyName.MyProjectName/MainWindow.xaml.cs index be1004415d..a8244aa270 100644 --- a/templates/wpf/src/MyCompanyName.MyProjectName/MainWindow.xaml.cs +++ b/templates/wpf/src/MyCompanyName.MyProjectName/MainWindow.xaml.cs @@ -1,17 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; namespace MyCompanyName.MyProjectName { diff --git a/templates/wpf/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj b/templates/wpf/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj index c1a57201f4..75a7074db5 100644 --- a/templates/wpf/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj +++ b/templates/wpf/src/MyCompanyName.MyProjectName/MyCompanyName.MyProjectName.csproj @@ -14,7 +14,7 @@ - + From f3b08e63f2ca69d547ee16f5e707e943616e2a67 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 11:12:50 +0300 Subject: [PATCH 047/101] CmsKit - Add missin [Serializable] attribute to EntityNotCommentableException --- .../Volo/CmsKit/Comments/EntityNotCommentableException.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs index 12c3c872fc..ee1a8621bb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/EntityNotCommentableException.cs @@ -8,6 +8,7 @@ using Volo.Abp; namespace Volo.CmsKit.Comments { + [Serializable] public class EntityNotCommentableException : BusinessException { public EntityNotCommentableException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) From 96e84af31b58e6887dd28c734a6319f14a5c85fc Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 11:23:00 +0300 Subject: [PATCH 048/101] CmsKit - Add missing Checks in CommentsManager --- .../Volo/CmsKit/Comments/CommentManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs index 59a3664e09..bbc44c4d06 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Comments/CommentManager.cs @@ -1,4 +1,5 @@ -using JetBrains.Annotations; + +using JetBrains.Annotations; using System; using System.Threading.Tasks; using Volo.Abp; @@ -23,6 +24,9 @@ namespace Volo.CmsKit.Comments [CanBeNull] Guid? repliedCommentId = null) { Check.NotNull(creator, nameof(creator)); + Check.NotNullOrWhiteSpace(entityType, nameof(entityType), CommentConsts.MaxEntityTypeLength); + Check.NotNullOrWhiteSpace(entityId, nameof(entityId), CommentConsts.MaxEntityIdLength); + Check.NotNullOrWhiteSpace(text, nameof(text), CommentConsts.MaxTextLength); if (!await DefinitionStore.IsDefinedAsync(entityType)) { From 06a318fca3199b0d127db3cfcb58492ae3538688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 4 Mar 2021 11:37:02 +0300 Subject: [PATCH 049/101] Use distributed events to handle role delete & rename for permission management. --- .../Identity/IdentityRoleNameChangedEto.cs | 16 +++++ .../Abp/Identity/AbpIdentityDomainModule.cs | 3 + .../Volo/Abp/Identity/IdentityRole.cs | 12 ++++ .../Identity/IdentityRoleNameChangedEvent.cs | 5 +- .../Identity/RoleDeletedEventHandler.cs | 34 +++++------ .../Identity/RoleUpdateEventHandler.cs | 60 ++++++++----------- 6 files changed, 76 insertions(+), 54 deletions(-) create mode 100644 modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleNameChangedEto.cs diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleNameChangedEto.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleNameChangedEto.cs new file mode 100644 index 0000000000..b8ae9e537b --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleNameChangedEto.cs @@ -0,0 +1,16 @@ +using System; + +namespace Volo.Abp.Identity +{ + [Serializable] + public class IdentityRoleNameChangedEto + { + public Guid Id { get; set; } + + public Guid? TenantId { get; set; } + + public string Name { get; set; } + + public string OldName { get; set; } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs index 4326d1aeb8..79f5fb647b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs @@ -40,6 +40,9 @@ namespace Volo.Abp.Identity options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); + + options.AutoEventSelectors.Add(); + options.AutoEventSelectors.Add(); }); var identityBuilder = context.Services.AddAbpIdentity(options => diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs index dac173719a..f856ee2277 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs @@ -108,12 +108,24 @@ namespace Volo.Abp.Identity Name = name; AddLocalEvent( +#pragma warning disable 618 new IdentityRoleNameChangedEvent +#pragma warning restore 618 { IdentityRole = this, OldName = oldName } ); + + AddDistributedEvent( + new IdentityRoleNameChangedEto + { + Id = Id, + Name = Name, + OldName = oldName, + TenantId = TenantId + } + ); } public override string ToString() diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs index f14f0a71ed..86fc5eab3e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs @@ -1,5 +1,8 @@ -namespace Volo.Abp.Identity +using System; + +namespace Volo.Abp.Identity { + [Obsolete("Use the distributed event (IdentityRoleNameChangedEto) instead.")] public class IdentityRoleNameChangedEvent { public IdentityRole IdentityRole { get; set; } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs index b3fd565b24..6b562a3f16 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs @@ -1,26 +1,26 @@ using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus; using Volo.Abp.Identity; namespace Volo.Abp.PermissionManagement.Identity { - // public class RoleDeletedEventHandler : - // ILocalEventHandler>, - // ITransientDependency - // { - // protected IPermissionManager PermissionManager { get; } - // - // public RoleDeletedEventHandler(IPermissionManager permissionManager) - // { - // PermissionManager = permissionManager; - // } - // - // public virtual async Task HandleEventAsync(EntityDeletedEventData eventData) - // { - // await PermissionManager.DeleteAsync(RolePermissionValueProvider.ProviderName, eventData.Entity.Name); - // } - // } + public class RoleDeletedEventHandler : + ILocalEventHandler>, + ITransientDependency + { + protected IPermissionManager PermissionManager { get; } + + public RoleDeletedEventHandler(IPermissionManager permissionManager) + { + PermissionManager = permissionManager; + } + + public async Task HandleEventAsync(EntityDeletedEto eventData) + { + await PermissionManager.DeleteAsync(RolePermissionValueProvider.ProviderName, eventData.Entity.Name); + } + } } diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs index 18612bcfad..d2d25ec3e8 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs @@ -1,45 +1,33 @@ using System.Threading.Tasks; using Volo.Abp.Authorization.Permissions; using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; +using Volo.Abp.EventBus.Distributed; using Volo.Abp.Identity; namespace Volo.Abp.PermissionManagement.Identity { - //TODO: This code can not be here! + public class RoleUpdateEventHandler : + IDistributedEventHandler, + ITransientDependency + { + protected IPermissionManager PermissionManager { get; } + protected IPermissionGrantRepository PermissionGrantRepository { get; } + + public RoleUpdateEventHandler( + IPermissionManager permissionManager, + IPermissionGrantRepository permissionGrantRepository) + { + PermissionManager = permissionManager; + PermissionGrantRepository = permissionGrantRepository; + } - // public class RoleUpdateEventHandler : - // ILocalEventHandler, - // ITransientDependency - // { - // protected IIdentityRoleRepository RoleRepository { get; } - // protected IPermissionManager PermissionManager { get; } - // protected IPermissionGrantRepository PermissionGrantRepository { get; } - // - // public RoleUpdateEventHandler( - // IIdentityRoleRepository roleRepository, - // IPermissionManager permissionManager, - // IPermissionGrantRepository permissionGrantRepository) - // { - // RoleRepository = roleRepository; - // PermissionManager = permissionManager; - // PermissionGrantRepository = permissionGrantRepository; - // } - // - // public virtual async Task HandleEventAsync(IdentityRoleNameChangedEvent eventData) - // { - // var role = await RoleRepository.FindAsync(eventData.IdentityRole.Id, false); - // if (role == null) - // { - // return; - // } - // - // var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync(RolePermissionValueProvider.ProviderName, eventData.OldName); - // foreach (var permissionGrant in permissionGrantsInRole) - // { - // await PermissionManager.UpdateProviderKeyAsync(permissionGrant, eventData.IdentityRole.Name); - // } - // } - // } + public async Task HandleEventAsync(IdentityRoleNameChangedEto eventData) + { + var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync(RolePermissionValueProvider.ProviderName, eventData.OldName); + foreach (var permissionGrant in permissionGrantsInRole) + { + await PermissionManager.UpdateProviderKeyAsync(permissionGrant, eventData.Name); + } + } + } } From 833c4c16eae932e084114504fac4f8a0a532a17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 4 Mar 2021 11:56:09 +0300 Subject: [PATCH 050/101] Should invalidate the cache for old permission provider key. --- .../PermissionGrantCacheItemInvalidator.cs | 4 +++- .../PermissionManagement/PermissionManager.cs | 22 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs index 9e73e59b79..585c0a0559 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs @@ -7,7 +7,9 @@ using Volo.Abp.MultiTenancy; namespace Volo.Abp.PermissionManagement { - public class PermissionGrantCacheItemInvalidator : ILocalEventHandler>, ITransientDependency + public class PermissionGrantCacheItemInvalidator : + ILocalEventHandler>, + ITransientDependency { protected ICurrentTenant CurrentTenant { get; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs index fc8da0c6c5..1f1e28dfd4 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; @@ -24,6 +25,8 @@ namespace Volo.Abp.PermissionManagement protected IReadOnlyList ManagementProviders => _lazyProviders.Value; protected PermissionManagementOptions Options { get; } + + protected IDistributedCache Cache { get; } private readonly Lazy> _lazyProviders; @@ -33,10 +36,12 @@ namespace Volo.Abp.PermissionManagement IServiceProvider serviceProvider, IGuidGenerator guidGenerator, IOptions options, - ICurrentTenant currentTenant) + ICurrentTenant currentTenant, + IDistributedCache cache) { GuidGenerator = guidGenerator; CurrentTenant = currentTenant; + Cache = cache; PermissionGrantRepository = permissionGrantRepository; PermissionDefinitionManager = permissionDefinitionManager; Options = options.Value; @@ -104,9 +109,21 @@ namespace Volo.Abp.PermissionManagement await provider.SetAsync(permissionName, providerKey, isGranted); } - + public virtual async Task UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey) { + using (CurrentTenant.Change(permissionGrant.TenantId)) + { + //Invalidating the cache for the old key + await Cache.RemoveAsync( + PermissionGrantCacheItem.CalculateCacheKey( + permissionGrant.Name, + permissionGrant.ProviderName, + permissionGrant.ProviderKey + ) + ); + } + permissionGrant.ProviderKey = providerKey; return await PermissionGrantRepository.UpdateAsync(permissionGrant); } @@ -114,7 +131,6 @@ namespace Volo.Abp.PermissionManagement public virtual async Task DeleteAsync(string providerName, string providerKey) { var permissionGrants = await PermissionGrantRepository.GetListAsync(providerName, providerKey); - //TODO: Use DeleteManyAsync method foreach (var permissionGrant in permissionGrants) { await PermissionGrantRepository.DeleteAsync(permissionGrant); From 92ec8c37431b8a1f334261b548857ee215a71f83 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Thu, 4 Mar 2021 15:03:06 +0300 Subject: [PATCH 051/101] Add missing localizations --- .../Admin/Localization/Resources/en.json | 16 +++++++++++++++- .../Admin/Localization/Resources/tr.json | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 0ada3327df..545b9d7f38 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -216,6 +216,20 @@ "FailReason": "Fail reason", "ReIndexAllPosts": "ReIndex All Posts", "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", - "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts" + "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts", + "Menu:CliAnalytics": "Cli Analytics", + "TemplateName": "Template name", + "TemplateVersion": "Template version", + "DatabaseProvider": "Database provider", + "IsTiered": "Is Tiered", + "ProjectName": "Project name", + "Username": "User name", + "Tool": "Tool", + "Command": "Command", + "UiFramework": "Ui framework", + "Options": "Options", + "CliAnalytics": "Cli Analytics", + "Permission:CliAnalyticses": "Cli Analyticses", + "Permission:CliAnalytics": "Cli Analytics" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json index 34ee392140..e9a652cdfd 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json @@ -166,6 +166,19 @@ "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir", "ReIndexAllPosts": "Yeniden indeksle", "ReIndexAllPostsConfirmationMessage": "Tüm gönderileri yeniden indeksleyeceğinizden emin misiniz?", - "SuccessfullyReIndexAllPosts": "Tüm gönderiler başarıyla yeniden indekslendi" + "SuccessfullyReIndexAllPosts": "Tüm gönderiler başarıyla yeniden indekslendi", + "Menu:CliAnalytics": "Cli Analitik", + "TemplateName": "Şablon ismi", + "TemplateVersion": "Şablon versiyon", + "DatabaseProvider": "Veritabanı sağlayıcı", + "IsTiered": "Katmanlı mı", + "ProjectName": "Proje ismi", + "Username": "Kullanıcı adı", + "Command": "Komut", + "UiFramework": "Ui çerçevesi", + "Options": "Seçenekler", + "CliAnalytics": "Cli Analitik", + "Permission:CliAnalyticses": "Cli Analitikleri", + "Permission:CliAnalytics": "Cli Analitik" } } \ No newline at end of file From 5f9944f6245179820bb83519b1be090b7d5bca4a Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 15:10:27 +0300 Subject: [PATCH 052/101] ABP CLI microservice creation should edit tye.yml according to ui type resolves https://github.com/volosoft/volo/issues/5689 --- .../Steps/RemoveProjectFromTyeStep.cs | 54 +++++++++++++++++++ .../Microservice/MicroserviceTemplateBase.cs | 10 ++++ 2 files changed, 64 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs new file mode 100644 index 0000000000..9804ef7c4b --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class RemoveProjectFromTyeStep : ProjectBuildPipelineStep + { + private readonly string _name; + + public RemoveProjectFromTyeStep(string name) + { + _name = name; + } + + public override void Execute(ProjectBuildContext context) + { + var tyeFile = context.Files.FirstOrDefault(f => f.Name == "/tye.yaml"); + + if (tyeFile == null) + { + return; + } + + var lines = tyeFile.Content.SplitToLines(); + var newLines = new List(); + + var nameLine = $"- name:"; + var isOneOfTargetLines = false; + + foreach (var line in lines) + { + if (line.Equals($"{nameLine} {_name}")) + { + isOneOfTargetLines = true; + continue; + } + + if (line.StartsWith(nameLine)) + { + isOneOfTargetLines = false; + } + + if (!isOneOfTargetLines) + { + newLines.Add(line); + } + } + + tyeFile.SetContent(String.Join(Environment.NewLine, newLines)); + } + + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs index 0a56f5272a..1efbe09ff1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs @@ -36,9 +36,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web",null, "/applications/web/src/MyCompanyName.MyProjectName.Web")); steps.Add(new RemoveFolderStep("/applications/web")); + steps.Add(new RemoveProjectFromTyeStep("web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor",null, "/applications/blazor/src/MyCompanyName.MyProjectName.Blazor")); steps.Add(new RemoveFolderStep("/applications/blazor")); + steps.Add(new RemoveProjectFromTyeStep("blazor")); + steps.Add(new RemoveFolderStep("/angular")); break; @@ -46,9 +50,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web",null, "/applications/web/src/MyCompanyName.MyProjectName.Web")); steps.Add(new RemoveFolderStep("/applications/web")); + steps.Add(new RemoveProjectFromTyeStep("web")); + steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor",null, "/applications/blazor/src/MyCompanyName.MyProjectName.Blazor")); steps.Add(new RemoveFolderStep("/applications/blazor")); + steps.Add(new RemoveProjectFromTyeStep("blazor")); break; case UiFramework.Blazor: @@ -56,6 +63,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice "/applications/web/src/MyCompanyName.MyProjectName.Web")); steps.Add(new RemoveFolderStep("/applications/web")); steps.Add(new RemoveFolderStep("/angular")); + steps.Add(new RemoveProjectFromTyeStep("web")); break; case UiFramework.Mvc: @@ -63,6 +71,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Blazor",null, "/applications/blazor/src/MyCompanyName.MyProjectName.Blazor")); steps.Add(new RemoveFolderStep("/applications/blazor")); + steps.Add(new RemoveProjectFromTyeStep("blazor")); + steps.Add(new RemoveFolderStep("/angular")); break; } From a44f9a1a8c2596efb81f62dd89ebf977fb90d52f Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 15:17:49 +0300 Subject: [PATCH 053/101] Cli SolutionRenameStep: rename lowercase --- .../Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs index 1ea30fe783..7da16ae8f3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs @@ -90,6 +90,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps RenameHelper.RenameAll(_entries, _projectNamePlaceHolder, _projectName); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToCamelCase(), _projectName.ToCamelCase()); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToKebabCase(), _projectName.ToKebabCase()); + RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToLowerInvariant(), _projectName.ToLowerInvariant()); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToSnakeCase().ToUpper(), _projectName.ToSnakeCase().ToUpper()); } } From 96f0c03fd84f77798a662227d81a3f7419c30cb3 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 15:22:10 +0300 Subject: [PATCH 054/101] Update RemoveProjectFromTyeStep.cs --- .../ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs index 9804ef7c4b..1c51e22bc9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromTyeStep.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps return; } - var lines = tyeFile.Content.SplitToLines(); + var lines = tyeFile.GetLines(); var newLines = new List(); var nameLine = $"- name:"; From 003eca038f10909a185c4ca9d2faa2e56508556c Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 15:26:59 +0300 Subject: [PATCH 055/101] Revert "Cli SolutionRenameStep: rename lowercase" This reverts commit a44f9a1a8c2596efb81f62dd89ebf977fb90d52f. --- .../Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs index 7da16ae8f3..1ea30fe783 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs @@ -90,7 +90,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps RenameHelper.RenameAll(_entries, _projectNamePlaceHolder, _projectName); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToCamelCase(), _projectName.ToCamelCase()); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToKebabCase(), _projectName.ToKebabCase()); - RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToLowerInvariant(), _projectName.ToLowerInvariant()); RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToSnakeCase().ToUpper(), _projectName.ToSnakeCase().ToUpper()); } } From 5bb7cf4bfe242f111df546034190ec524932b3d8 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 15:37:44 +0300 Subject: [PATCH 056/101] Cli: optimize remover resolves https://github.com/abpframework/abp/issues/7938 --- .../Building/Steps/RemoveCmsKitStep.cs | 8 ++------ .../Steps/RemoveEfCoreDependencyFromPublicStep.cs | 9 +++++++-- .../Steps/RemoveGlobalFeaturesPackageStep.cs | 11 +++++++++-- .../Building/Steps/RemovePublicRedisStep.cs | 14 +++++--------- .../ProjectBuilding/Files/FileEntryExtensions.cs | 10 ++++++++++ 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs index 789f9e47cb..93bb454c4d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs @@ -9,12 +9,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { var commonFiles = context.Files.Where(f => f.Name.EndsWith(".csproj") || - f.Name.EndsWith("Module.cs") || - f.Name.EndsWith("MyProjectNameMigrationsDbContext.cs") || - f.Name.EndsWith("MyProjectNameMigrationsDbContextBase.cs") || - f.Name.EndsWith("MyProjectNameGlobalFeatureConfigurator.cs") || - (f.Name.EndsWith(".cshtml") && f.Name.Contains("MyCompanyName.MyProjectName.Web.Public")) - ); + f.Name.EndsWith(".cs") || + f.Name.EndsWith(".cshtml")); foreach (var file in commonFiles) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs index f9e906c902..1f7b8f4e6f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveEfCoreDependencyFromPublicStep.cs @@ -7,8 +7,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { public override void Execute(ProjectBuildContext context) { - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.Public.csproj"))?.RemoveTemplateCodeIfNot("EFCORE"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebPublicModule.cs"))?.RemoveTemplateCodeIfNot("EFCORE"); + foreach (var file in context.Files) + { + if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".json")) + { + file.RemoveTemplateCodeIfNot("EFCORE"); + } + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs index 06fd565353..15a84576c6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveGlobalFeaturesPackageStep.cs @@ -7,8 +7,15 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { public override void Execute(ProjectBuildContext context) { - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Domain.Shared.csproj"))?.RemoveTemplateCodeIf("CMS-KIT"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameDomainSharedModule.cs"))?.RemoveTemplateCodeIf("CMS-KIT"); + var commonFiles = context.Files.Where(f => + f.Name.EndsWith(".csproj") || + f.Name.EndsWith(".cs") || + f.Name.EndsWith(".cshtml")); + + foreach (var file in commonFiles) + { + file.RemoveTemplateCodeIf("CMS-KIT"); + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs index 1299f5b15d..eced4fd3e5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemovePublicRedisStep.cs @@ -8,16 +8,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { public override void Execute(ProjectBuildContext context) { - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.Web.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameWebModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.HttpApi.Host.csproj"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); - context.Files.FirstOrDefault(f => f.Name.EndsWith("MyProjectNameHttpApiHostModule.cs"))?.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); - - var appSettingsFiles = context.Files.Where(f => f.Name.EndsWith("appSettings.json", StringComparison.InvariantCultureIgnoreCase)).ToList(); - foreach (var appSettings in appSettingsFiles) + foreach (var file in context.Files) { - appSettings.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + if (file.Name.EndsWith(".cs") || file.Name.EndsWith(".csproj") || file.Name.EndsWith(".json")) + { + file.RemoveTemplateCodeIfNot("PUBLIC-REDIS"); + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs index 91180206bf..34200d41ac 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Files/FileEntryExtensions.cs @@ -28,6 +28,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files public static void RemoveTemplateCodeMarkers(this FileEntry file) { + if (!file.Content.Contains("")) + { + return; + } + file.NormalizeLineEndings(); var lines = file.GetLines(); @@ -59,6 +64,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Files private static void RemoveMarkedTemplateCode(this FileEntry file, string beginMark) { + if (!file.Content.Contains("")) + { + return; + } + file.NormalizeLineEndings(); var lines = file.GetLines(); From 81540b4943891667ee79554565139ebd190a0444 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Thu, 4 Mar 2021 15:37:48 +0300 Subject: [PATCH 057/101] Update en.json --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 0ada3327df..51d818aad7 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -91,6 +91,7 @@ "UserNotFound": "User not found", "{0}WillBeRemovedFromDevelopers": "{0} Will be removed from developers, do you confirm?", "{0}WillBeRemovedFromOwners": "{0} Will be removed from owners, do you confirm?", + "{0}WillBeRemovedFromMembers": "{0} Will be removed from members, do you confirm?", "Computers": "Computers", "UniqueComputerId": "Unique computer id", "LastSeenDate": "Last seen date", From a0a9f85253613723519dc7085e5582c814c09c63 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 16:00:55 +0300 Subject: [PATCH 058/101] CmsKit - Fix ShortDescription generation for BlogPost --- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index e1e132e2a0..977c90fde0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -8,7 +8,7 @@ var $shortDescription = $('#ViewModel_ShortDescription'); var $url = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-create'); - var $pageContentInput = $('#ViewModel_Value'); + var $pageContentInput = $('#ViewModel_Content'); var $tagsInput = $('.tag-editor-form input[name=tags]'); var $fileInput = $('#BlogPostCoverImage'); var $tagsWrapper = $('#blog-post-tags-wrapper'); From 3e13a547c349b0fa8a05cc8d3a2e14dc9eb71d9c Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 16:03:35 +0300 Subject: [PATCH 059/101] CmsKit - Fix permission tree --- .../Permissions/CmsKitAdminPermissionDefinitionProvider.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs index a8317b6b6b..284ce15827 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Permissions/CmsKitAdminPermissionDefinitionProvider.cs @@ -52,9 +52,9 @@ namespace Volo.CmsKit.Permissions blogManagement.AddChild(CmsKitAdminPermissions.Blogs.Features, L("Permission:BlogManagement.Features")); var blogPostManagement = cmsGroup.AddPermission(CmsKitAdminPermissions.BlogPosts.Default, L("Permission:BlogPostManagement")); - blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Create, L("Permission:BlogPostManagement.Create")); - blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Update, L("Permission:BlogPostManagement.Update")); - blogManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Delete, L("Permission:BlogPostManagement.Delete")); + blogPostManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Create, L("Permission:BlogPostManagement.Create")); + blogPostManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Update, L("Permission:BlogPostManagement.Update")); + blogPostManagement.AddChild(CmsKitAdminPermissions.BlogPosts.Delete, L("Permission:BlogPostManagement.Delete")); } } From 0b17b2fb7229d6decb385939449ee97d0ee79efe Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 16:13:50 +0300 Subject: [PATCH 060/101] CmsKit - Routing fix --- .../cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs | 2 +- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js | 2 +- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js | 2 +- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js | 4 ++-- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs index 25dd69cd63..ed162cc360 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs @@ -82,7 +82,7 @@ namespace Volo.CmsKit.Admin.Web options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Create", "/Cms/BlogPosts/Create"); options.Conventions.AddPageRoute("/CmsKit/BlogPosts/Update", "/Cms/BlogPosts/Update/{Id}"); options.Conventions.AddPageRoute("/CmsKit/Comments/Index", "/Cms/Comments"); - options.Conventions.AddPageRoute("/CmsKit/Comments/Details", "/Cms/Details"); + options.Conventions.AddPageRoute("/CmsKit/Comments/Details", "/Cms/Comments/{Id}"); }); Configure(options => diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js index c4453c1a9c..c2a9c7d364 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/index.js @@ -60,7 +60,7 @@ { text: l('Details'), action: function (data) { - window.location = abp.appPath + 'CmsKit/Comments/Details/' + data.record.id; + location.href = 'Comments/' + data.record.id; } }, { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js index 029ab189cd..5872dad438 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/create.js @@ -19,7 +19,7 @@ success: function (result) { abp.notify.success(l('SuccessfullySaved')); abp.ui.clearBusy(); - location.href = "/CmsKit/Pages/"; + location.href = "../Pages"; } }); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js index 4d4ea4c9e3..828da9c55c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/index.js @@ -30,7 +30,7 @@ text: l('Edit'), visible: abp.auth.isGranted('CmsKit.Pages.Update'), action: function (data) { - location.href = '/CmsKit/Pages/Update/' + data.record.id; + location.href = 'Pages/Update/' + data.record.id; } }, { @@ -76,6 +76,6 @@ $('#AbpContentToolbar button[name=CreatePage]').on('click', function (e) { e.preventDefault(); - window.location.href = "/CmsKit/Pages/Create" + window.location.href = "Pages/Create" }); }); \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js index 1dd4734150..8e8ba3d85d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/update.js @@ -18,7 +18,7 @@ success: function (result) { abp.notify.success(l('SuccessfullySaved')); abp.ui.clearBusy(); - location.href = "/CmsKit/Pages/"; + location.href = "../../Pages"; } }); } From 2b9b56a75bca7adc4242fa411398ba2ce6318aed Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 4 Mar 2021 21:54:25 +0800 Subject: [PATCH 061/101] Add unit tests --- .../Identity/RoleDeletedEventHandler.cs | 7 +- .../Distributed_Role_Change_Events_Test.cs | 105 ++++++++++++++++++ .../Abp/Identity/RoleChangingEvents_Test.cs | 60 ---------- 3 files changed, 109 insertions(+), 63 deletions(-) create mode 100644 modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_Role_Change_Events_Test.cs delete mode 100644 modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs index 6b562a3f16..4a25abea50 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs @@ -3,21 +3,22 @@ using Volo.Abp.Authorization.Permissions; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus; +using Volo.Abp.EventBus.Distributed; using Volo.Abp.Identity; namespace Volo.Abp.PermissionManagement.Identity { public class RoleDeletedEventHandler : - ILocalEventHandler>, + IDistributedEventHandler>, ITransientDependency { protected IPermissionManager PermissionManager { get; } - + public RoleDeletedEventHandler(IPermissionManager permissionManager) { PermissionManager = permissionManager; } - + public async Task HandleEventAsync(EntityDeletedEto eventData) { await PermissionManager.DeleteAsync(RolePermissionValueProvider.ProviderName, eventData.Entity.Name); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_Role_Change_Events_Test.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_Role_Change_Events_Test.cs new file mode 100644 index 0000000000..a57a8baf69 --- /dev/null +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_Role_Change_Events_Test.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Identity; +using Shouldly; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using Volo.Abp.Caching; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.PermissionManagement; +using Volo.Abp.PermissionManagement.Identity; +using Volo.Abp.Uow; +using Xunit; + +namespace Volo.Abp.Identity +{ + public class Distributed_Role_Change_Events_Test : AbpIdentityDomainTestBase + { + protected readonly IIdentityRoleRepository RoleRepository; + protected readonly IPermissionGrantRepository PermissionGrantRepository; + protected readonly IdentityRoleManager RoleManager; + protected readonly ILookupNormalizer LookupNormalizer; + protected readonly IUnitOfWorkManager UowManager; + protected readonly IDistributedCache Cache; + + public Distributed_Role_Change_Events_Test() + { + RoleRepository = GetRequiredService(); + ; + PermissionGrantRepository = GetRequiredService(); + ; + RoleManager = GetRequiredService(); + ; + LookupNormalizer = GetRequiredService(); + ; + UowManager = GetRequiredService(); + Cache = GetRequiredService>(); + } + + [Fact] + public void Should_Register_Handler() + { + var x = GetRequiredService>(); + GetRequiredService>() + .Value + .AutoEventSelectors + .ShouldContain(m => m.Name == "Entity:" + typeof(IdentityRole).FullName); + + GetRequiredService>() + .Value + .Handlers + .ShouldContain(h => h == typeof(RoleUpdateEventHandler) || h == typeof(RoleDeletedEventHandler)); + } + + [Fact] + public async Task Role_Updated_Distributed_Event_Test() + { + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")); + + var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); + permissionGrantsInRole.ShouldNotBeNull(); + permissionGrantsInRole.Count.ShouldBeGreaterThan(0); + var count = permissionGrantsInRole.Count; + + using (var uow = UowManager.Begin()) + { + var identityResult = await RoleManager.SetRoleNameAsync(role, "TestModerator"); + identityResult.Succeeded.ShouldBeTrue(); + await RoleRepository.UpdateAsync(role); + await uow.CompleteAsync(); + } + + role = await RoleRepository.GetAsync(role.Id); + role.Name.ShouldBe("TestModerator"); + + permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); + permissionGrantsInRole.Count.ShouldBe(count); + } + + [Fact] + public async Task Role_Deleted_Distributed_Event_Test() + { + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")); + var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); + + var caches = permissionGrantsInRole.Select(x => new KeyValuePair( + PermissionGrantCacheItem.CalculateCacheKey(x.Name, x.ProviderName, x.ProviderKey), + new PermissionGrantCacheItem(true))).ToList(); + await Cache.SetManyAsync(caches); + + + using (var uow = UowManager.Begin()) + { + await RoleRepository.DeleteAsync(role); + await uow.CompleteAsync(); + } + + var permissionGrantCaches = await Cache.GetManyAsync(caches.Select(x=>x.Key)); + foreach (var cache in permissionGrantCaches) + { + cache.Value.ShouldBeNull(); + } + } + } +} diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs deleted file mode 100644 index a668b5ff4f..0000000000 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Shouldly; -using System.Threading.Tasks; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Guids; -using Volo.Abp.PermissionManagement; -using Volo.Abp.Uow; -using Xunit; - -namespace Volo.Abp.Identity -{ - //TODO: This code can not be here! - //https://github.com/abpframework/abp/commit/847f526041145b62376b760776829d5ce257da1c - // public class RoleChangingEvents_Test : AbpIdentityDomainTestBase - // { - // protected readonly IIdentityRoleRepository RoleRepository; - // protected readonly IPermissionGrantRepository PermissionGrantRepository; - // protected readonly IdentityRoleManager RoleManager; - // protected readonly ILookupNormalizer LookupNormalizer; - // protected readonly IGuidGenerator GuidGenerator; - // protected readonly IUnitOfWorkManager UowManager; - // - // public RoleChangingEvents_Test() - // { - // RoleRepository = GetRequiredService(); ; - // PermissionGrantRepository = GetRequiredService(); ; - // RoleManager = GetRequiredService(); ; - // LookupNormalizer = GetRequiredService(); ; - // GuidGenerator = GetRequiredService(); - // UowManager = GetRequiredService(); - // } - // - // [Fact(Skip = "https://github.com/abpframework/abp/actions/runs/454248191")] - // public async Task Role_Update_Event_Test() - // { - // var role = await RoleRepository - // .FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")) - // ; - // - // var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); - // permissionGrantsInRole.ShouldNotBeNull(); - // permissionGrantsInRole.Count.ShouldBeGreaterThan(0); - // var count = permissionGrantsInRole.Count; - // - // using (var uow = UowManager.Begin()) - // { - // var identityResult = await RoleManager.SetRoleNameAsync(role, "TestModerator"); - // identityResult.Succeeded.ShouldBeTrue(); - // var xx = await RoleRepository.UpdateAsync(role); - // await uow.CompleteAsync(); - // } - // - // role = await RoleRepository.GetAsync(role.Id); - // role.Name.ShouldBe("TestModerator"); - // - // permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); - // permissionGrantsInRole.Count.ShouldBe(count); - // } - // } -} From e6c02dd8d71ac81a6f8c86a929780340d52df358 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 17:11:11 +0300 Subject: [PATCH 062/101] Update CmsKit npm package --- npm/packs/cms-kit/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/packs/cms-kit/package.json b/npm/packs/cms-kit/package.json index 47f4efcc75..e539cf68c8 100644 --- a/npm/packs/cms-kit/package.json +++ b/npm/packs/cms-kit/package.json @@ -5,7 +5,9 @@ "access": "public" }, "dependencies": { - "@abp/star-rating-svg": "~4.2.1" + "@abp/star-rating-svg": "~4.2.1", + "@abp/tui-editor": "^4.2.1", + "slugify": "^1.4.7" }, "gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431" } From 6fe057ca0b37b1394f31f6e54838f9f7122bcc59 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 4 Mar 2021 17:11:36 +0300 Subject: [PATCH 063/101] Update tui-editor npm package --- npm/packs/tui-editor/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/npm/packs/tui-editor/package.json b/npm/packs/tui-editor/package.json index 968d9d58c8..28176e5742 100644 --- a/npm/packs/tui-editor/package.json +++ b/npm/packs/tui-editor/package.json @@ -12,5 +12,8 @@ "tui-editor": "^1.4.10", "tui-code-snippet": "^2.3.2" }, + "resolutions": { + "jquery": "3.4.1" + }, "gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431" } From 0eae7d569ee258628da9a3145ed4eab888be4a7b Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 4 Mar 2021 17:17:45 +0300 Subject: [PATCH 064/101] Cli: RemoveCmsKitStep json files --- .../Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs index 93bb454c4d..a0778d5a4d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveCmsKitStep.cs @@ -10,6 +10,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var commonFiles = context.Files.Where(f => f.Name.EndsWith(".csproj") || f.Name.EndsWith(".cs") || + f.Name.EndsWith(".json") || f.Name.EndsWith(".cshtml")); foreach (var file in commonFiles) From c7404550eb774cb1efc8d910c7814c1d95e550b6 Mon Sep 17 00:00:00 2001 From: tanyongzheng Date: Fri, 5 Mar 2021 11:37:34 +0800 Subject: [PATCH 065/101] docs:Update Repositories.md --- docs/zh-Hans/Repositories.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-Hans/Repositories.md b/docs/zh-Hans/Repositories.md index 79186b79da..857df51439 100644 --- a/docs/zh-Hans/Repositories.md +++ b/docs/zh-Hans/Repositories.md @@ -150,7 +150,7 @@ var people = _personRepository * 这里异步方法**不是标准LINQ方法**,它们定义在[Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore)Nuget包中. * 标准模板应用层与领域层**不引用**EF Core 包以实现数据库提供程序独立. -根据你的需求和开发模式,你可以根据以下选项使用异步方法.s +根据你的需求和开发模式,你可以根据以下选项使用异步方法. > 强烈建议使用异步方法! 在执行数据库查询时不要使用同步LINQ方法,以便能够开发可伸缩的应用程序. From ab0253ea415bd3a26c8e2d2fde2f59bb2a1d6cb8 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 5 Mar 2021 15:57:47 +0800 Subject: [PATCH 066/101] Add tui-editor-jquery-patch.js. --- .../UI/Packages/TuiEditor/TuiEditorScriptContributor.cs | 1 + npm/packs/tui-editor/abp.resourcemapping.js | 3 ++- npm/packs/tui-editor/src/tui-editor-jquery-patch.js | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 npm/packs/tui-editor/src/tui-editor-jquery-patch.js diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs index e788c612cf..e2e826445f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs @@ -16,6 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor { public override void ConfigureBundle(BundleConfigurationContext context) { + context.Files.AddIfNotContains("/libs/tui-editor/tui-editor-jquery-patch.js"); context.Files.AddIfNotContains("/libs/to-mark/to-mark.min.js"); if (context.FileProvider.GetFileInfo("/libs/tui-code-snippet/tui-code-snippet.min.js").Exists) diff --git a/npm/packs/tui-editor/abp.resourcemapping.js b/npm/packs/tui-editor/abp.resourcemapping.js index 53a3e493f7..a1d944d7f1 100644 --- a/npm/packs/tui-editor/abp.resourcemapping.js +++ b/npm/packs/tui-editor/abp.resourcemapping.js @@ -3,6 +3,7 @@ "@node_modules/to-mark/dist/to-mark.min.js": "@libs/to-mark/", "@node_modules/tui-code-snippet/dist/*.*": "@libs/tui-code-snippet/", "@node_modules/squire-rte/build/squire.js": "@libs/squire-rte/", - "@node_modules/tui-editor/dist/*.*": "@libs/tui-editor/" + "@node_modules/tui-editor/dist/*.*": "@libs/tui-editor/", + "@node_modules/@abp/tui-editor/src/*.*": "@libs/tui-editor/" } } \ No newline at end of file diff --git a/npm/packs/tui-editor/src/tui-editor-jquery-patch.js b/npm/packs/tui-editor/src/tui-editor-jquery-patch.js new file mode 100644 index 0000000000..1033d18992 --- /dev/null +++ b/npm/packs/tui-editor/src/tui-editor-jquery-patch.js @@ -0,0 +1,7 @@ +/* + https://jquery.com/upgrade-guide/3.5/#jquery-htmlprefilter-changes +*/ +var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi; +jQuery.htmlPrefilter = function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); +}; From 6b3fdaf68bed96a29ec75f325f64af9290d1de9a Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 11:03:14 +0300 Subject: [PATCH 067/101] Remove custom resolutions section from tui-editor package.json --- npm/packs/tui-editor/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/npm/packs/tui-editor/package.json b/npm/packs/tui-editor/package.json index 28176e5742..968d9d58c8 100644 --- a/npm/packs/tui-editor/package.json +++ b/npm/packs/tui-editor/package.json @@ -12,8 +12,5 @@ "tui-editor": "^1.4.10", "tui-code-snippet": "^2.3.2" }, - "resolutions": { - "jquery": "3.4.1" - }, "gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431" } From 4d9f49d25bb71ae8280e22d1bff3d59d957380d7 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 5 Mar 2021 12:02:24 +0300 Subject: [PATCH 068/101] Set random port when a new Microservice is created resolves https://github.com/volosoft/volo/issues/5716 --- .../MicroserviceServiceRandomPortStep.cs | 78 +++++++++++++++++++ .../MicroserviceServiceTemplateBase.cs | 6 ++ 2 files changed, 84 insertions(+) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs new file mode 100644 index 0000000000..88a19b43af --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/MicroserviceServiceRandomPortStep.cs @@ -0,0 +1,78 @@ +using System; +using System.IO; +using System.Linq; +using Volo.Abp.Cli.Commands; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class MicroserviceServiceRandomPortStep : ProjectBuildPipelineStep + { + private readonly string _defaultPort = string.Empty; + private string _tyeFileContent = null; + + public MicroserviceServiceRandomPortStep(string defaultPort) + { + _defaultPort = defaultPort; + } + + public override void Execute(ProjectBuildContext context) + { + var newPort = GetNewRandomPort(context); + + var targetFiles = context.Files.Where(f=> f.Name.EndsWith("launchSettings.json") || f.Name.EndsWith("appsettings.json")).ToList(); + + foreach (var file in targetFiles) + { + file.SetContent(file.Content.Replace(_defaultPort, newPort)); + } + } + + private string GetNewRandomPort(ProjectBuildContext context) + { + string newPort; + var rnd = new Random(); + var tryCount = 0; + + do + { + newPort = rnd.Next(44350, 45350).ToString(); + + if (tryCount++ > 2000) + { + break; + } + + } while (PortExistsForAnotherService(context, newPort)); + + return newPort; + } + + private bool PortExistsForAnotherService(ProjectBuildContext context, string newPort) + { + return ReadTyeFileContent(context).SplitToLines().Any(l => l.Contains("port") && l.Contains(newPort)); + } + + private string ReadTyeFileContent(ProjectBuildContext context) + { + if (_tyeFileContent != null) + { + return _tyeFileContent; + } + + var solutionFolderPath = context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Short] ?? + context.BuildArgs.ExtraProperties[NewCommand.Options.OutputFolder.Long] ?? + Directory.GetCurrentDirectory(); + + var tyeFilePath = Path.Combine(solutionFolderPath, "tye.yaml"); + + if (!File.Exists(tyeFilePath)) + { + return String.Empty; + } + + _tyeFileContent = File.ReadAllText(tyeFilePath); + + return _tyeFileContent; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs index de589336b0..54ec4894b9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs @@ -31,6 +31,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice var steps = new List(); DeleteUnrelatedUiProject(context, steps); + SetRandomPortForHostProject(context, steps); RandomizeStringEncryption(context, steps); return steps; @@ -54,6 +55,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice } } + private static void SetRandomPortForHostProject(ProjectBuildContext context, List steps) + { + steps.Add(new MicroserviceServiceRandomPortStep("44371")); + } + private static void RandomizeStringEncryption(ProjectBuildContext context, List steps) { steps.Add(new RandomizeStringEncryptionStep()); From 202af0eb50237fbb217c9065926e8fa7e9aac5e2 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 5 Mar 2021 12:03:38 +0300 Subject: [PATCH 069/101] add HTTP Error Handling section to HTTP Requests document --- docs/en/UI/Angular/HTTP-Requests.md | 99 +++++++++++++++++- .../custom-error-handler-404-component.jpg | Bin 0 -> 6153 bytes .../custom-error-handler-toaster-message.jpg | Bin 0 -> 7589 bytes 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 docs/en/UI/Angular/images/custom-error-handler-404-component.jpg create mode 100644 docs/en/UI/Angular/images/custom-error-handler-toaster-message.jpg diff --git a/docs/en/UI/Angular/HTTP-Requests.md b/docs/en/UI/Angular/HTTP-Requests.md index ab1ac04097..f307c5811d 100644 --- a/docs/en/UI/Angular/HTTP-Requests.md +++ b/docs/en/UI/Angular/HTTP-Requests.md @@ -27,13 +27,13 @@ An `HttpInterceptor` is able to catch `HttpErrorResponse`  and can be used for ## RestService -ABP core module has a utility service for HTTP requests: `RestService`. Unless explicitly configured otherwise, it catches HTTP errors and dispatches a `RestOccurError` action. This action is then captured by the `ErrorHandler` introduced by the `ThemeSharedModule`. Since you should already import this module in your app, when the `RestService` is used, all HTTP errors get automatically handled by deafult. +ABP core module has a utility service for HTTP requests: `RestService`. Unless explicitly configured otherwise, it catches HTTP errors and dispatches a `RestOccurError` action. This action is then captured by the `ErrorHandler` introduced by the `ThemeSharedModule`. Since you should already import this module in your app, when the `RestService` is used, all HTTP errors get automatically handled by default. ### Getting Started with RestService -In order to use the `RestService`, you must inject it in your class as a dependency. +In order to use the `RestService`, you must inject it in your class as a dependency. ```js import { RestService } from '@abp/ng.core'; @@ -200,6 +200,99 @@ getSomeCustomHeaderValue() { } ``` +You may find `Rest.Observe` enum [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L10). -You may find `Rest.Observe` enum [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/core/src/lib/models/rest.ts#L10). +## HTTP Error Handling + +When the `RestService` is used, all HTTP errors are automatically handled by `ErrorHandler` which is a service that exposed by the `@abp/ng.theme.shared` package. + +### Custom HTTP Error Handler + +A custom HTTP error handler can be registered to an injection token named `HTTP_ERROR_HANDLER`. If a custom handler function is registered, the `ErrorHandler` executes that function. + +See an example: + +```js +// http-error-handler.ts +import { ContentProjectionService, PROJECTION_STRATEGY } from '@abp/ng.core'; +import { ToasterService } from '@abp/ng.theme.shared'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Injector } from '@angular/core'; +import { throwError } from 'rxjs'; +import { Error404Component } from './error404/error404.component'; + +export function handleHttpErrors(injector: Injector, httpError: HttpErrorResponse) { + if (httpError.status === 400) { + const toaster = injector.get(ToasterService); + toaster.error(httpError.error?.error?.message || 'Bad request!', '400'); + return; + } + + if (httpError.status === 404) { + const contentProjection = injector.get(ContentProjectionService); + contentProjection.projectContent(PROJECTION_STRATEGY.AppendComponentToBody(Error404Component)); + return; + } + + return throwError(httpError); +} + +// app.module.ts +import { Error404Component } from './error404/error404.component'; +import { handleHttpErrors } from './http-error-handling'; +import { HTTP_ERROR_HANDLER, ... } from '@abp/ng.theme.shared'; + +@NgModule({ + // ... + providers: [ + // ... + { provide: HTTP_ERROR_HANDLER, useValue: handleHttpErrors } + ], + declarations: [ + //... + Error404Component], +}) +export class AppModule {} +``` + +In the example above: + + - Created a function named `handleHttpErrors` and defined as value of the `HTTP_ERROR_HANDLER` provider in app.module. After this, the function executes when an HTTP error occurs. + - 400 bad request errors is handled. When a 400 error occurs, backend error message will be displayed as shown below: + + ![custom-error-handler-toaster-message](images/custom-error-handler-toaster-message.jpg) + + - 404 not found errors is handled. When a 404 error occurs, `Error404Component` will be appended to the `` as shown below: + +![custom-error-handler-404-component](images/custom-error-handler-404-component.jpg) + + - Since `throwError(httpError)` is returned at bottom of the `handleHttpErrors`, the `ErrorHandler` will handle the HTTP errors except 400 and 404 errors. + + +**Note 1:** If you put `return` to next line of handling an error, default error handling will not work for that error. + +```js +export function handleHttpErrors(injector: Injector, httpError: HttpErrorResponse) { + if (httpError.status === 403) { + // handle 403 errors here + return; // put return to skip default error handling + } +} +``` + +**Note 2:** If you put `return throwError(httpError)`, default error handling will work. + - `throwError` is a function. It can be imported from `rxjs`. + - `httpError` is the second parameter of the error handler function which is registered to the `HTTP_ERROR_HANDLER` provider. Type of the `httpError` is `HttpErrorResponse`. + +```js +export function handleHttpErrors(injector: Injector, httpError: HttpErrorResponse) { + if (httpError.status === 500) { + // handle 500 errors here + return; + } + + // you can return the throwError(httpError) at bottom of the function to run the default handler of ABP for HTTP errors that you didn't handle above. + return throwError(httpError) +} +``` diff --git a/docs/en/UI/Angular/images/custom-error-handler-404-component.jpg b/docs/en/UI/Angular/images/custom-error-handler-404-component.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e4b2f15c5075991203d8ad91bbd4eb42a9070d51 GIT binary patch literal 6153 zcmeIwc}&w+902fNDM#g~l&XV3X@pr+eu}EDr?l4+cOW5D>aH0o@xQ2rxA+M%x{2rw`J8GsEJohDJ{xaV`E?;}P<)0Zpre2T2{!!0_0(t?xfL=f^pcnXm3K(+j9WPHx3zCx3(gYMCztm3X zI6X9xOCFiX3P#MuKN@l&ctyLQ8a-xZQpJzKMt!tU6;uo1)pey45N!#fh<==__C@q2 z%y5p(hBo8F^h`aXwPRFqssS^X!W-|JRAPEvcluO!o-B@UQR{--G;7+g|D;@{Qm))rJN zb$~DZ6@GVeCI;>?-J8UY&{m4Kuu|BoYE7uTR2p$-__xLPoAFzfPdl7jXjet-_=njj z=Tby5TF4$TlAZ{=vN8&A|UKK(#_nV(8;h>sO}hJ`epn4A;2#4bDO0Qat@Y(+}? zQ32OJzLMzGdYS?k9(F78O}8WOI)@@PJqZgZB^<-WW(8#2#f^$W;s|!a#VmFOlN`&u z<+Sw7Ul|jAL{gYpi9&h1tJ}HS9v!f`?=pbFL7Itd)BbZ@*l*IdD5tK2@orsRcOMy@pOsv!^U8_JN3aS$;vlywl3zjJ6h? zlgR2;I!5;vCP&x%wMfsnX*jg1uf{g05vadQ$A_oAymN4!+(xo}B!09JeV#_3WJ~a7 zA-{g$_-8lcW~&D0;9gHs)T|^WnQ#(^JuA#ZLi5UOse;Mu#k6L{7=xR^;WJyh*e&mt zRMR2ym5~RTEf`HFH72S*Ji~jA=vLJ~r&9Mii=mNm#gZHLL79Sjb2LMgieErTJ!ZA3 zZm?5DWC=ExK)lo@E461NGDMWvh5S0K4*20QhP)}) zA0{}_tLgje!);I$_`K%6U(DU6M{yOGI9r#(bIGo0o&mR1t4^~O<@DEu2$gxFaEdNy zmf}YmrK3C~R9RB85(w|?^K^B=2VHp{Tkp@0KU8~$J0(NYuH6q&Ts;$(mb`%7LsZz* zQpzaTP-cer>j?afm$W}_{?zj^1PdPO%k=09iY-M&$VNVFFLvij~i{5*FK4eM# zK57AJL_UDxHp)C;+4(inUtSd4&TpaZ_8g^TDM^zs{XZb1xJbbMl_@9TiT z=HhaReNZm`*oo=E_5!Y( BlV|_{ literal 0 HcmV?d00001 diff --git a/docs/en/UI/Angular/images/custom-error-handler-toaster-message.jpg b/docs/en/UI/Angular/images/custom-error-handler-toaster-message.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c1cced8237a13bf0e18ec9d4e4b08ddb6f527c26 GIT binary patch literal 7589 zcmeHMc{p6zwlC3!PCC*eq)m~ODO8G>Ln%6;%taSfN>FsiJV%*gj&zWaq77wM+E^4y zh$6;nNz6ebrOaY1LlBA*5JaWP2= zpcwFq6i7{8N=8}c3h??(1!Z-JmX?;JoUWmcrhyt%3-TF+?ev*5JZE`CzWr7Naus+L z@~7qaHvlg;p!Sp%I~x#iikFR@m+kl!K={N|z$tb%z#qcN#&PN^F7}f`y>9_*?Cfmp z+?-sT9PAvQtFWD7|B8e6JSV>b-<6x@$mD{-3qZtAzSUfcDt=K(`QpmAux;-Jl6K(PS5qk^@j#==NM zz|@qv?b()o(by>jwX|_#qjcsCCMXD*&hFzE`_mrMXI1V5Ol|ifW{M{H+r;GTXgKXJ zz`w@u-=d96w!FG`(C5r^0HhyQvE zXtd8dU*cgsc%G;o)t)FauCh?d`E7S)=jWN=Yxh+#b6x)!AR87}e^+8N&yD&v5BTI5 z;E}(x*{3~h2T*|g_GQZaug`3hv6))2J!7U0(kn1@o$GMu)9(cBR>5ZUY)$SBkp%Et ztcHBnXL#SBQ>Oc@?2~Dz1#@_QK4_qJ=2O}B)d5zcnCYkCLzTDee9Zta)rd~$(ZaY@ zx(=_3v6NPM*uWhr7X!VKxL4!hVh~u|Y-sMCf@oV@M}z3=kuYR^{h{EH-lMf>#}tUj zyLg(M=GQxLsP7Mu#f%t2}*?JOHe| zc>3MW(N}iuW0#vTgw@(U6_C0XWK&Has!?fe(M;Fs85yI_lxL)V}O`;d0ryl?9(@XC8NJ3;QFi`lN@`( z?NK&Nq^##NeFP=j&`fyPw)BlV@c>~>B@xj3Zb~%GlpD^pqU|B+)&xr9;YY`m1G|^Rp0)+s5LwS42EJ*t;y0O z(1uRhZGOIN*?aB%uX4NL> z$B#!V5w7ky@<7DV-vR?)=iW=TxKFAU^-*1O(_G>O`@f#J%XRTfDA>1Hu!KZOhkb+} z1A6{7EVQjs_3K84JdXjzC&7jk(tsu!`2oY|TbiYNXD)cfwd;1=H4viaM{plmH&79^ z9XG1bBa0R)qICr&+ycROaJHj^zGXjby%`tI_JPoc#8xyKQN9UeC}Do$och77>WR`F zTbb!D>C91o?wkQu17G2^O_ntLPPky$*%g5-Yp6}y;pK^-izTE;+M&JP3T=xO+Qo5# zRwWa#lOA#lBGdo86MbpGw?a-U(KGFU-fjN_3$DrY@-p&(&?)QxF)nPRTjA_*{Kc5! zsuJpE!8RSG;#ET^Dd2c;+bY4|y#dtG-T0kt`D-*3#&-GB7L1j9IaIBdnRzQiVMq#esa!U($esAxPD%YuGtI}b zCh_=BPxaONL-Cu~hJITTX%S_@<^gZ9n{PLX^mGMqSN>bP2ArPC9AAZSq}_vlZEwi{ zW$nBWKg>#>G-Mwi_t1FJoUxYNY7=tR3*vD1*A_zzLY$Eh6frJ|oxil{tZ|MoGF`fv zZuw?#xB_l4NcKzOwQHqyF1SW*68s0hduc!=h-UzR&;QfRd}kwQjh|33S~wU4c5KGU zr=1f81)g(tprEzl$Vev@eGT<{Do3;r#2xTUA8upW{T$O~q2T_YHH zLeGizp4hlaG79a^pwU|F#p$s+7Ndmu$q!k`F=2=gWKbq0b-w!;z)7xymOQD=UMb9+ z)r4JNTS{=1dM7zJ0-k%6LspSgg*v&^&u=IPPT=7sjT$}rD@pOgZQbweeK%r~0`>aW zUf3QAs_QZqjsa1akFg>%!JiwUc=?2)2eb&VK#4)>iSF3ONg zmY~$&?W_X|a%Y={)Hh@2-|kxQu+EkBt0*MQpe4b^%5b6Cz8*RCXTM{LYhv$=)a{lf z7ZHkE8Y$t9{gEZ%k2h72tZYYt82h^9kjM7cyH>NY+zh`h`#k-dP(lvXb8GI7i`CAi z(lOxiW%KE4fi%kS^tGX$RYQq|;spCjVJdamKaenH=GxqtoNh0bR6X6eh%Lj5t7KqI zD7CNjsm{L&c#qj&y+p}BvnFvEd60C~K>3+A-wl>w8i1q?YM%k&m3*t(Pcq{Vld2LK|b(yB@K{b|f9#bnxLu@0J(9ccx_ zaDmPtj7`;$RGGhN&%tw(orqIz*I5l~Ny$}r^v$#{1{374JKvmQi0vg)4eCVs;Z&ACCVWRHL5(@UM`_X z3K>T<;!kKGoDv~tLzJzKf3U4-ATgrr84DCORe zzByg~>>ciG=sLWy$w*E z9Vu=`s-|hARvJcnuPAg^sl8_|z?E^1FuQAZ`zgk=O`zH|Gym6@7@7 zzV$Ig+ajjlT84Zc4Zl0m<1QOya0rT~{hp`PRnh-=0_;JiRvp#Gjwh!XjXy8@sZ$1& zgzK4AEIEkDbNaC!2JLXq%F4u}ek?f#%$YEq(1J^ClWCpC?&Ba))Heg+V1Hbg8!)7= zgW$Az<(&m9`q?X!j+82`K3y9SHmjx)-<&A({gnCQr%9#PZt)H4zf1;ZyNO;)QTQ>| zCRlo9pu8=-?6pVb2nfdi0Md70NTcw)x~}sOyTv&C8m@80jJMY&G$Qp{{0n)hjcOd6z8#Ba_%{HOh=C+w<{Er~#+FsBKqtv0+=rKtJri--C zd^67F^3yf#ixHW829J&b4;t3p5;sk|zh$$q`qwq=B*EC*`MURVpqlgNIL|N=sGJiS&=2pfIC6=0Rq`d z^;PvRdO(Ht%4e4xyBhrXM$3kx4>?92FvMhFD3R_XJj3keiGJvDT3dh; zJlL4ihutKlGT3;=v^ad^!Pxn38q3J+$rPOIW_m{ew(aK~}l(O-u2BFs1Os2o|5=?#54?*_B3%Bv# z6O42FF|gDr%$rr+6MrBOyw7wVeQl{s@Kw@Y#P|{e`#n9t_ynI48d9R150iV=#Q*5) z{oLGwvGVAnd5-?^q+VkLyArVL(UTYcjJ)kD3(1D|Wc`K>yL36^(s<^WP{-JU$HjQW z>LcoX=Bw?Dh3)Ip+Now*k>o0)G7rJ}Ks~*6PcH$XP4|#VM($Juz2X>f_ZYA*LtiX@ zldvdOR`w8MoT?K?I*~Bsps^CA#x8P6&y9oDT;fJ!7)*+%GdLI)c}IzhHM{1;C@ zBmy(uH|ke-tczZ3QhSDHxf>Vl3DjNeHee}&T^ErZsNnRs{;pokbj5o`cl881H1aSE%MyeX!-A8r%;6qKq=ZAa8xY*$$^ z6FL_6isQ%^u+{IYt$%4iKv8x%^I}KYJyzbdGn&F^9hl@9ar=Yfp}6NOCVoV-TbFFf zsK8@ruB(WxNBucVN)oOs()xbl9}4Jo$Oy z*7}QubuZO^%XR*KNM#-j4mI)Wr4;(hN}D2M7R3tn>RtQ&85scpg%uJoX$44U0^<8?(v}q*wjx<_2#Y1{3DRg_mjO z5q--Gw#>VommWBwP$%P4K17u6yN1(iMK@HwO~8__EX-J?mc_U!C}+2Cn zP1pLNW16cPnX~RSG7AovcA;Hei@09k%Ikz(tt#zvQBWfI!p5^DrU!j@AbU{e7_b37 z*>LrwZmDeMr?>|yPVrN0BvGfzC8BH}J)g~~QoAKT2iqQ6>|Yd14|jTV5)=6p%&zg! zzNx}ZkEkOeb^1zLpRzQSJ8uwtiLQfgDA%mMozUB6$fW}vqQe4?td9*_dAPLam(@g* z90I4-wvw!a%pI;%@-U4lnny#y!$vz;4gDtbMeHJjCr!V)!au=Jc-Oi-)htS|)+pem zYp!zuql)Ii zk67pO2feYAp(pfq?&$U|FRBPjY0obgDv&F(3nNy;m%d3R3ylOkRJ`{t6Qq)n5V`q7 S7su<%e?BPuAGJ7lJoaCszdtVk literal 0 HcmV?d00001 From 9dd4ee1674f0fe7fd8e04ec3e9716fdb1cc9fcc0 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 5 Mar 2021 12:05:03 +0300 Subject: [PATCH 070/101] add an import to the HTTP-Request.md --- docs/en/UI/Angular/HTTP-Requests.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/UI/Angular/HTTP-Requests.md b/docs/en/UI/Angular/HTTP-Requests.md index f307c5811d..aeb55578b8 100644 --- a/docs/en/UI/Angular/HTTP-Requests.md +++ b/docs/en/UI/Angular/HTTP-Requests.md @@ -286,6 +286,8 @@ export function handleHttpErrors(injector: Injector, httpError: HttpErrorRespons - `httpError` is the second parameter of the error handler function which is registered to the `HTTP_ERROR_HANDLER` provider. Type of the `httpError` is `HttpErrorResponse`. ```js +import { throwError } from 'rxjs'; + export function handleHttpErrors(injector: Injector, httpError: HttpErrorResponse) { if (httpError.status === 500) { // handle 500 errors here From fe5399026fb75468a0692cf616acb14e941d7767 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 5 Mar 2021 12:10:06 +0300 Subject: [PATCH 071/101] create HTTP_ERROR_HANDLER injection token --- .../packages/theme-shared/src/lib/models/common.ts | 9 ++++++++- .../theme-shared/src/lib/tokens/http-error.token.ts | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/models/common.ts b/npm/ng-packs/packages/theme-shared/src/lib/models/common.ts index 64047e0db7..0e8dd9e592 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/models/common.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/models/common.ts @@ -1,5 +1,7 @@ -import { Type } from '@angular/core'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Injector, Type } from '@angular/core'; import { Validation } from '@ngx-validate/core'; +import { Observable } from 'rxjs'; export interface RootParams { httpErrorConfig: HttpErrorConfig; @@ -17,4 +19,9 @@ export interface HttpErrorConfig { }; } +export type HttpErrorHandler = ( + injector: Injector, + httpError: HttpErrorResponse, +) => Observable; + export type LocaleDirection = 'ltr' | 'rtl'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tokens/http-error.token.ts b/npm/ng-packs/packages/theme-shared/src/lib/tokens/http-error.token.ts index 62f2d2d593..39cb43a350 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tokens/http-error.token.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tokens/http-error.token.ts @@ -1,5 +1,5 @@ import { InjectionToken } from '@angular/core'; -import { HttpErrorConfig } from '../models/common'; +import { HttpErrorConfig, HttpErrorHandler } from '../models/common'; export function httpErrorConfigFactory(config = {} as HttpErrorConfig) { if (config.errorScreen && config.errorScreen.component && !config.errorScreen.forWhichErrors) { @@ -13,4 +13,6 @@ export function httpErrorConfigFactory(config = {} as HttpErrorConfig) { } as HttpErrorConfig; } -export const HTTP_ERROR_CONFIG = new InjectionToken('HTTP_ERROR_CONFIG'); +export const HTTP_ERROR_CONFIG = new InjectionToken('HTTP_ERROR_CONFIG'); + +export const HTTP_ERROR_HANDLER = new InjectionToken('HTTP_ERROR_HANDLER'); From 7e46a48e78d686e37bc2ebcde540fb8805e0a8ca Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 5 Mar 2021 12:11:05 +0300 Subject: [PATCH 072/101] execute custom error handler if it exists --- .../src/lib/handlers/error.handler.ts | 229 ++++++++++-------- 1 file changed, 124 insertions(+), 105 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index 1835b80eef..cad4567285 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -12,13 +12,14 @@ import { } from '@angular/core'; import { NavigationError, ResolveEnd } from '@angular/router'; import { Actions, ofActionSuccessful } from '@ngxs/store'; -import { Observable, Subject } from 'rxjs'; -import { filter, map } from 'rxjs/operators'; +import { Observable, of, Subject, throwError } from 'rxjs'; +import { catchError, filter, map, switchMap } from 'rxjs/operators'; import snq from 'snq'; import { HttpErrorWrapperComponent } from '../components/http-error-wrapper/http-error-wrapper.component'; import { ErrorScreenErrorCodes, HttpErrorConfig } from '../models/common'; import { Confirmation } from '../models/confirmation'; import { ConfirmationService } from '../services/confirmation.service'; +import { HTTP_ERROR_HANDLER } from '../tokens/http-error.token'; export const DEFAULT_ERROR_MESSAGES = { defaultError: { @@ -70,28 +71,32 @@ export const DEFAULT_ERROR_LOCALIZATIONS = { export class ErrorHandler { componentRef: ComponentRef; + protected httpErrorHandler = this.injector.get(HTTP_ERROR_HANDLER, (_, err: HttpErrorResponse) => + throwError(err), + ); + constructor( - private actions: Actions, - private routerEvents: RouterEvents, - private confirmationService: ConfirmationService, - private cfRes: ComponentFactoryResolver, - private rendererFactory: RendererFactory2, - private injector: Injector, - @Inject('HTTP_ERROR_CONFIG') private httpErrorConfig: HttpErrorConfig, + protected actions: Actions, + protected routerEvents: RouterEvents, + protected confirmationService: ConfirmationService, + protected cfRes: ComponentFactoryResolver, + protected rendererFactory: RendererFactory2, + protected injector: Injector, + @Inject('HTTP_ERROR_CONFIG') protected httpErrorConfig: HttpErrorConfig, ) { this.listenToRestError(); this.listenToRouterError(); this.listenToRouterDataResolved(); } - private listenToRouterError() { + protected listenToRouterError() { this.routerEvents .getNavigationEvents('Error') .pipe(filter(this.filterRouteErrors)) .subscribe(() => this.show404Page()); } - private listenToRouterDataResolved() { + protected listenToRouterDataResolved() { this.routerEvents .getEvents(ResolveEnd) .pipe(filter(() => !!this.componentRef)) @@ -101,113 +106,127 @@ export class ErrorHandler { }); } - private listenToRestError() { + protected listenToRestError() { this.actions .pipe( ofActionSuccessful(RestOccurError), map(action => action.payload), filter(this.filterRestErrors), + switchMap(this.executeErrorHandler), ) - .subscribe(err => { - const body = snq(() => err.error.error, { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, - }); + .subscribe(); + } - if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) { - const confirmation$ = this.showError(null, null, body); + private executeErrorHandler = err => { + const returnValue = this.httpErrorHandler(this.injector, err); - if (err.status === 401) { - confirmation$.subscribe(() => { - this.navigateToLogin(); - }); - } - } else { - switch (err.status) { - case 401: - this.canCreateCustomError(401) - ? this.show401Page() - : this.showError( - { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title, - }, - { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.details, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details, - }, - ).subscribe(() => this.navigateToLogin()); - break; - case 403: - this.createErrorComponent({ - title: { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.title, - }, - details: { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.details, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.details, - }, - status: 403, - }); - break; - case 404: - this.canCreateCustomError(404) - ? this.show404Page() - : this.showError( - { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.details, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.details, - }, - { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title, - }, - ); - break; - case 500: - this.createErrorComponent({ - title: { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.title, + return (returnValue instanceof Observable ? returnValue : of(null)).pipe( + catchError(err => { + this.handleError(err); + return of(null); + }), + ); + }; + + private handleError(err: any) { + const body = snq(() => err.error.error, { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + }); + + if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) { + const confirmation$ = this.showError(null, null, body); + + if (err.status === 401) { + confirmation$.subscribe(() => { + this.navigateToLogin(); + }); + } + } else { + switch (err.status) { + case 401: + this.canCreateCustomError(401) + ? this.show401Page() + : this.showError( + { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title, }, - details: { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.details, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.details, + { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.details, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details, }, - status: 500, - }); - break; - case 0: - if (err.statusText === 'Unknown Error') { - this.createErrorComponent({ - title: { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, - }, - details: err.message, - isHomeShow: false, - }); - } - break; - default: - this.showError( + ).subscribe(() => this.navigateToLogin()); + break; + case 403: + this.createErrorComponent({ + title: { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.title, + }, + details: { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError403.details, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.details, + }, + status: 403, + }); + break; + case 404: + this.canCreateCustomError(404) + ? this.show404Page() + : this.showError( { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.details, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.details, + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.details, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.details, }, { - key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title, }, ); - break; + break; + case 500: + this.createErrorComponent({ + title: { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.title, + }, + details: { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError500.details, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.details, + }, + status: 500, + }); + break; + case 0: + if (err.statusText === 'Unknown Error') { + this.createErrorComponent({ + title: { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + }, + details: err.message, + isHomeShow: false, + }); } - } - }); + break; + default: + this.showError( + { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.details, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.details, + }, + { + key: DEFAULT_ERROR_LOCALIZATIONS.defaultError.title, + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + }, + ); + break; + } + } } - private show401Page() { + protected show401Page() { this.createErrorComponent({ title: { key: DEFAULT_ERROR_LOCALIZATIONS.defaultError401.title, @@ -217,7 +236,7 @@ export class ErrorHandler { }); } - private show404Page() { + protected show404Page() { this.createErrorComponent({ title: { key: DEFAULT_ERROR_LOCALIZATIONS.defaultError404.title, @@ -227,7 +246,7 @@ export class ErrorHandler { }); } - private showError( + protected showError( message?: LocalizationParam, title?: LocalizationParam, body?: any, @@ -256,7 +275,7 @@ export class ErrorHandler { }); } - private navigateToLogin() { + protected navigateToLogin() { this.injector.get(AuthService).initLogin(); } @@ -304,13 +323,13 @@ export class ErrorHandler { ); } - private filterRestErrors = ({ status }: HttpErrorResponse): boolean => { + protected filterRestErrors = ({ status }: HttpErrorResponse): boolean => { if (typeof status !== 'number') return false; return this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === status) < 0; }; - private filterRouteErrors = (navigationError: NavigationError): boolean => { + protected filterRouteErrors = (navigationError: NavigationError): boolean => { return ( snq(() => navigationError.error.message.indexOf('Cannot match') > -1) && this.httpErrorConfig.skipHandledErrorCodes.findIndex(code => code === 404) < 0 From 442144e9f0ccaa4f207bab84139f3772d9fcebe8 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 5 Mar 2021 12:55:48 +0300 Subject: [PATCH 073/101] fix a lint error --- .../packages/theme-shared/src/lib/handlers/error.handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index cad4567285..1001c98085 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -117,8 +117,8 @@ export class ErrorHandler { .subscribe(); } - private executeErrorHandler = err => { - const returnValue = this.httpErrorHandler(this.injector, err); + private executeErrorHandler = error => { + const returnValue = this.httpErrorHandler(this.injector, error); return (returnValue instanceof Observable ? returnValue : of(null)).pipe( catchError(err => { From b41804e37c227c1c517edd05603eff3500d2160d Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 13:36:32 +0300 Subject: [PATCH 074/101] CmsKit - Fix MediaDescriptor mismatching Id --- .../Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs index 45774ca1f2..ab7d841cad 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/MediaDescriptors/MediaDescriptorAdminAppService.cs @@ -35,12 +35,11 @@ namespace Volo.CmsKit.Admin.MediaDescriptors await CheckAnyOfPoliciesAsync(definition.CreatePolicies); - var newId = GuidGenerator.Create(); using (var stream = inputStream.GetStream()) { var newEntity = await MediaDescriptorManager.CreateAsync(inputStream.EntityType, inputStream.Name, inputStream.ContentType, inputStream.ContentLength ?? 0); - await MediaContainer.SaveAsync(newId.ToString(), stream); + await MediaContainer.SaveAsync(newEntity.Id.ToString(), stream); await MediaDescriptorRepository.InsertAsync(newEntity); return ObjectMapper.Map(newEntity); From c177530c5ea46b35bedafc2c1d02f4ff4d86be77 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Fri, 5 Mar 2021 13:37:11 +0300 Subject: [PATCH 075/101] Handle abbreviations like XYZ when converting to camel-case. issue #7951 --- .../System/AbpStringExtensions.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs index f272484611..5fe47112ba 100644 --- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs @@ -260,8 +260,9 @@ namespace System /// /// String to convert /// set true to use current culture. Otherwise, invariant culture will be used. + /// set true to if you want to convert 'XYZ' to 'xyz'. /// camelCase of the string - public static string ToCamelCase(this string str, bool useCurrentCulture = false) + public static string ToCamelCase(this string str, bool useCurrentCulture = false, bool handleAbbreviations = false) { if (string.IsNullOrWhiteSpace(str)) { @@ -273,6 +274,11 @@ namespace System return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant(); } + if (handleAbbreviations && IsAllUpperCase(str)) + { + return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant(); + } + return (useCurrentCulture ? char.ToLower(str[0]) : char.ToLowerInvariant(str[0])) + str.Substring(1); } @@ -545,5 +551,18 @@ namespace System return encoding.GetBytes(str); } + + private static bool IsAllUpperCase(string input) + { + for (int i = 0; i < input.Length; i++) + { + if (Char.IsLetter(input[i]) && !Char.IsUpper(input[i])) + { + return false; + } + } + + return true; + } } } From a09a7ac659d08b50080b78e8743287aea01ee3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 5 Mar 2021 14:30:52 +0300 Subject: [PATCH 076/101] Revise title for blog and page. --- .../CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml | 2 +- .../Pages/CmsKit/Shared/Components/Pages/Default.cshtml | 4 +--- .../Pages/Public/CmsKit/Blogs/BlogPost.cshtml | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml index 0ed8987d72..f5c1bdc3a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -4,10 +4,10 @@ @inject IStringLocalizer L +

@Model.Title

- @Model.Title @Model.Author?.UserName diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml index ae23d5757f..99d743aed9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml @@ -3,9 +3,7 @@ @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages.PageViewModel @inject IPageLayout PageLayout -@{ - PageLayout.Content.Title = Model.Title; -} +

@Model.Title

diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index abff0a475e..8ad6dd9ca3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -13,10 +13,6 @@ @model Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs.BlogPostModel -@{ - PageLayout.Content.Title = Model.BlogPost.Title; -} - @await Component.InvokeAsync(typeof(DefaultBlogPostViewComponent), new { Model.BlogSlug, From bfce8f57023393c8c691edc6e3e135bc76c27d4e Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 14:42:29 +0300 Subject: [PATCH 077/101] CmsKit - Add CoverImage to BlogPost --- ...0305104055_BlogPost_CoverImage.Designer.cs | 1951 +++++++++++++++++ .../20210305104055_BlogPost_CoverImage.cs | 56 + .../UnifiedDbContextModelSnapshot.cs | 75 +- .../Volo.CmsKit.Web.Unified.csproj | 4 - .../Volo/CmsKit/Admin/Blogs/BlogPostDto.cs | 2 + .../CmsKit/Admin/Blogs/CreateBlogPostDto.cs | 2 + .../Admin/Blogs/IBlogPostAdminAppService.cs | 3 - .../Admin/Blogs/BlogPostAdminAppService.cs | 30 +- .../Admin/Blogs/BlogPostAdminController.cs | 44 +- .../Volo/CmsKit/Blogs/BlogPost.cs | 12 +- .../Volo/CmsKit/Blogs/BlogPostManager.cs | 4 +- 11 files changed, 2031 insertions(+), 152 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs new file mode 100644 index 0000000000..506e8cf2db --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs @@ -0,0 +1,1951 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Migrations +{ + [DbContext(typeof(UnifiedDbContext))] + [Migration("20210305104055_BlogPost_CoverImage")] + partial class BlogPost_CoverImage + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)") + .HasColumnName("Exceptions"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnType("uniqueidentifier") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime2") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ContainerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("varbinary(max)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("TenantId", "ContainerId", "Name"); + + b.ToTable("AbpBlobs"); + }); + + modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpBlobContainers"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("SourceTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique() + .HasFilter("[SourceTenantId] IS NOT NULL AND [TargetTenantId] IS NOT NULL"); + + b.ToTable("AbpLinkUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("bit") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("bit") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("bit") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("nvarchar(96)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("nvarchar(196)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("nvarchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("nvarchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("nvarchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogs"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogFeature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("FeatureName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.ToTable("CmsBlogFeatures"); + }); + + modelBuilder.Entity("Volo.CmsKit.Blogs.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorId") + .HasColumnType("uniqueidentifier"); + + b.Property("BlogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CoverImage") + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("ShortDescription") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("Slug", "BlogId"); + + b.ToTable("CmsBlogPosts"); + }); + + modelBuilder.Entity("Volo.CmsKit.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("RepliedCommentId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "RepliedCommentId"); + + b.HasIndex("TenantId", "EntityType", "EntityId"); + + b.ToTable("CmsComments"); + }); + + modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Size") + .HasMaxLength(2147483647) + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("CmsMediaDescriptors"); + }); + + modelBuilder.Entity("Volo.CmsKit.Pages.Page", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .HasMaxLength(2147483647) + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Slug") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Slug"); + + b.ToTable("CmsPages"); + }); + + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("StarCount") + .HasColumnType("smallint"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "CreatorId"); + + b.ToTable("CmsRatings"); + }); + + modelBuilder.Entity("Volo.CmsKit.Reactions.UserReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("EntityId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ReactionName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "EntityType", "EntityId", "ReactionName"); + + b.HasIndex("TenantId", "CreatorId", "EntityType", "EntityId", "ReactionName"); + + b.ToTable("CmsUserReactions"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); + + b.HasIndex("TenantId", "EntityId", "TagId"); + + b.ToTable("CmsEntityTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Tags.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime2") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uniqueidentifier") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime2") + .HasColumnName("DeletionTime"); + + b.Property("EntityType") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime2") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uniqueidentifier") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("CmsTags"); + }); + + modelBuilder.Entity("Volo.CmsKit.Users.CmsUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("ExtraProperties") + .HasColumnType("nvarchar(max)") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Name"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Email"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("CmsUsers"); + }); + + 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.BlobStoring.Database.DatabaseBlob", b => + { + b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null) + .WithMany() + .HasForeignKey("ContainerId") + .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("Volo.CmsKit.Blogs.BlogPost", b => + { + b.HasOne("Volo.CmsKit.Users.CmsUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + 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/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs new file mode 100644 index 0000000000..4e68ebb210 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs @@ -0,0 +1,56 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class BlogPost_CoverImage : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CmsContents"); + + migrationBuilder.AddColumn( + name: "CoverImage", + table: "CmsBlogPosts", + type: "uniqueidentifier", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CoverImage", + table: "CmsBlogPosts"); + + migrationBuilder.CreateTable( + name: "CmsContents", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsContents", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CmsContents_TenantId_EntityType_EntityId", + table: "CmsContents", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + } + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index c14e469499..bd046eeb03 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1273,6 +1273,9 @@ namespace Volo.CmsKit.Migrations .HasMaxLength(2147483647) .HasColumnType("nvarchar(max)"); + b.Property("CoverImage") + .HasColumnType("uniqueidentifier"); + b.Property("CreationTime") .HasColumnType("datetime2") .HasColumnName("CreationTime"); @@ -1379,78 +1382,6 @@ namespace Volo.CmsKit.Migrations b.ToTable("CmsComments"); }); - modelBuilder.Entity("Volo.CmsKit.Contents.Content", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasMaxLength(40) - .HasColumnType("nvarchar(40)") - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnType("datetime2") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnType("uniqueidentifier") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnType("uniqueidentifier") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnType("datetime2") - .HasColumnName("DeletionTime"); - - b.Property("EntityId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.Property("ExtraProperties") - .HasColumnType("nvarchar(max)") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false) - .HasColumnName("IsDeleted"); - - b.Property("LastModificationTime") - .HasColumnType("datetime2") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnType("uniqueidentifier") - .HasColumnName("LastModifierId"); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier") - .HasColumnName("TenantId"); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2147483647) - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "EntityType", "EntityId"); - - b.ToTable("CmsContents"); - }); - modelBuilder.Entity("Volo.CmsKit.MediaDescriptors.MediaDescriptor", b => { b.Property("Id") diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj index 61be8d09f5..2595a1fde2 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Volo.CmsKit.Web.Unified.csproj @@ -62,8 +62,4 @@ - - - - diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs index 5222b50fe8..66c9b9ac95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs @@ -15,5 +15,7 @@ namespace Volo.CmsKit.Admin.Blogs public string ShortDescription { get; set; } public string Content { get; set; } + + public Guid? CoverImage { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs index 3e339c738c..39486ab356 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs @@ -24,5 +24,7 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } + + public Guid? CoverImage { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs index 846cba2d5b..ba144167a8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/IBlogPostAdminAppService.cs @@ -14,8 +14,5 @@ namespace Volo.CmsKit.Admin.Blogs CreateBlogPostDto, UpdateBlogPostDto> { - Task SetCoverImageAsync(Guid id, RemoteStreamContent streamContent); - - Task GetCoverImageAsync(Guid id); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index a25aa07a09..2a8fc1955f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -18,25 +18,22 @@ namespace Volo.CmsKit.Admin.Blogs { [RequiresGlobalFeature(typeof(BlogsFeature))] [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] - public class BlogPostAdminAppService: CmsKitAppServiceBase, IBlogPostAdminAppService + public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppService { protected BlogPostManager BlogPostManager { get; } protected IBlogPostRepository BlogPostRepository { get; } protected IBlogRepository BlogRepository { get; } - protected IBlobContainer BlobContainer { get; } protected ICmsUserLookupService UserLookupService { get; } public BlogPostAdminAppService( BlogPostManager blogPostManager, IBlogPostRepository blogPostRepository, IBlogRepository blogRepository, - IBlobContainer blobContainer, ICmsUserLookupService userLookupService) { BlogPostManager = blogPostManager; BlogPostRepository = blogPostRepository; BlogRepository = blogRepository; - BlobContainer = blobContainer; UserLookupService = userLookupService; } @@ -54,7 +51,8 @@ namespace Volo.CmsKit.Admin.Blogs input.Title, input.Slug, input.ShortDescription, - input.Content); + input.Content, + input.CoverImage); await BlogPostRepository.InsertAsync(blogPost); @@ -69,7 +67,7 @@ namespace Volo.CmsKit.Admin.Blogs blogPost.SetTitle(input.Title); blogPost.SetShortDescription(input.ShortDescription); blogPost.SetContent(input.Content); - + if (blogPost.Slug != input.Slug) { await BlogPostManager.SetSlugUrlAsync(blogPost, input.Slug); @@ -77,27 +75,9 @@ namespace Volo.CmsKit.Admin.Blogs await BlogPostRepository.UpdateAsync(blogPost); - return ObjectMapper.Map(blogPost); - } - - [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] - public virtual async Task SetCoverImageAsync(Guid id, RemoteStreamContent streamContent) - { - await BlogPostRepository.GetAsync(id); - - using (var stream = streamContent.GetStream()) - { - await BlobContainer.SaveAsync(id.ToString(), stream, overrideExisting: true); - } + return ObjectMapper.Map(blogPost); } - [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] - public virtual async Task GetCoverImageAsync(Guid id) - { - var stream = await BlobContainer.GetAsync(id.ToString()); - - return new RemoteStreamContent(stream); - } [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] public virtual async Task GetAsync(Guid id) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs index f1583cbe17..09f1d3a6cc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/Blogs/BlogPostAdminController.cs @@ -1,14 +1,9 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; -using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Permissions; @@ -52,50 +47,13 @@ namespace Volo.CmsKit.Admin.Blogs return BlogPostAdminAppService.GetAsync(id); } - [HttpGet] - [Route("{id}/cover-image")] - [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] - public virtual Task GetCoverImageAsync(Guid id) - { - Response.Headers.Add("Content-Disposition", $"inline;filename=\"{id}\""); - Response.Headers.Add("Accept-Ranges", "bytes"); - Response.Headers.Add("Cache-Control", "max-age=120"); - Response.ContentType = "image"; - - return BlogPostAdminAppService.GetCoverImageAsync(id); - } - [HttpGet] [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] public virtual Task> GetListAsync(PagedAndSortedResultRequestDto input) { return BlogPostAdminAppService.GetListAsync(input); } - - [NonAction] - public virtual Task SetCoverImageAsync(Guid id, RemoteStreamContent streamContent) - { - return BlogPostAdminAppService.SetCoverImageAsync(id, streamContent); - } - - [HttpPost] - [Route("{id}/cover-image")] - [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] - public virtual async Task UploadCoverImageAsync(Guid id, IFormFile file) - { - if (file == null) - { - return BadRequest(); - } - - using (var stream = file.OpenReadStream()) - { - await BlogPostAdminAppService.SetCoverImageAsync(id, new RemoteStreamContent(stream)); - } - - return CreatedAtAction(nameof(GetCoverImageAsync), new { id }); - } - + [HttpPut] [Route("{id}")] [Authorize(CmsKitAdminPermissions.BlogPosts.Update)] diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs index 251a9c2895..c1e5bba2d9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs @@ -12,17 +12,19 @@ namespace Volo.CmsKit.Blogs { public virtual Guid BlogId { get; protected set; } - [NotNull] + [NotNull] public virtual string Title { get; protected set; } - [NotNull] + [NotNull] public virtual string Slug { get; protected set; } - [NotNull] + [NotNull] public virtual string ShortDescription { get; protected set; } public virtual string Content { get; protected set; } - + + public Guid? CoverImage { get; set; } + public virtual Guid? TenantId { get; protected set; } public Guid AuthorId { get; set; } @@ -41,6 +43,7 @@ namespace Volo.CmsKit.Blogs [NotNull] string slug, [CanBeNull] string shortDescription = null, [CanBeNull] string content = null, + [CanBeNull] Guid? coverImage = null, [CanBeNull] Guid? tenantId = null) : base(id) { TenantId = tenantId; @@ -50,6 +53,7 @@ namespace Volo.CmsKit.Blogs SetSlug(slug); SetShortDescription(shortDescription); SetContent(content); + CoverImage = coverImage; } public virtual void SetTitle(string title) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs index 3e15b91117..bf5e9ef936 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs @@ -27,7 +27,8 @@ namespace Volo.CmsKit.Blogs [NotNull] string title, [NotNull] string slug, [CanBeNull] string shortDescription = null, - [CanBeNull] string content = null) + [CanBeNull] string content = null, + [CanBeNull] Guid? coverImage = null) { Check.NotNull(author, nameof(author)); Check.NotNull(blog, nameof(blog)); @@ -44,6 +45,7 @@ namespace Volo.CmsKit.Blogs slug, shortDescription, content, + coverImage, CurrentTenant.Id ); From e7ef36ba60d4128d3db1d5cc3f15bee23e4461ee Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 14:42:51 +0300 Subject: [PATCH 078/101] CmsKit - Remove BlogPostCoverImageContainer --- .../Volo/CmsKit/Blogs/BlogPostCoverImageContainer.cs | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostCoverImageContainer.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostCoverImageContainer.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostCoverImageContainer.cs deleted file mode 100644 index 824db4fe3a..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostCoverImageContainer.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.BlobStoring; - -namespace Volo.CmsKit.Blogs -{ - [BlobContainerName("blog-post-cover-images")] - public class BlogPostCoverImageContainer - { - } -} From 783e5879e05a1f5e1ef5c5443eb3fc041bc755d6 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 14:45:43 +0300 Subject: [PATCH 079/101] CmsKit - Remove BlogPostCoverImageContainer usages --- .../Public/Blogs/IBlogPostPublicAppService.cs | 2 -- .../CmsKit/Public/Blogs/BlogPostPublicAppService.cs | 13 +------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index 04234b4f06..4709e1219c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -12,7 +12,5 @@ namespace Volo.CmsKit.Public.Blogs Task> GetListAsync([NotNull] string blogSlug, PagedAndSortedResultRequestDto input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); - - Task GetCoverImageAsync(Guid id); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 644b4e4cc3..1c8ef3eed5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -15,16 +15,12 @@ namespace Volo.CmsKit.Public.Blogs protected IBlogPostRepository BlogPostRepository { get; } - protected IBlobContainer BlobContainer { get; } - public BlogPostPublicAppService( IBlogRepository blogRepository, - IBlogPostRepository blogPostRepository, - IBlobContainer blobContainer) + IBlogPostRepository blogPostRepository) { BlogRepository = blogRepository; BlogPostRepository = blogPostRepository; - BlobContainer = blobContainer; } public virtual async Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug) @@ -46,12 +42,5 @@ namespace Volo.CmsKit.Public.Blogs await BlogPostRepository.GetCountAsync(blog.Id), ObjectMapper.Map, List>(blogPosts)); } - - public virtual async Task GetCoverImageAsync(Guid id) - { - var stream = await BlobContainer.GetAsync(id.ToString()); - - return new RemoteStreamContent(stream); - } } } From e0b243aa850b6f382d8693a4128555197065f7a0 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 14:48:04 +0300 Subject: [PATCH 080/101] CmsKit - Fix Build & Tests --- .../Public/Blogs/BlogPostPublicController.cs | 12 ---------- .../Blogs/BlogPostAdminAppService_Tests.cs | 23 ------------------- 2 files changed, 35 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index e22ef54545..4b5aac6e86 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -29,18 +29,6 @@ namespace Volo.CmsKit.Public.Blogs return BlogPostPublicAppService.GetAsync(blogSlug, blogPostSlug); } - [HttpGet] - [Route("{id}/cover-image")] - public virtual Task GetCoverImageAsync(Guid id) - { - Response.Headers.Add("Content-Disposition", $"inline;filename=\"{id}\""); - Response.Headers.Add("Accept-Ranges", "bytes"); - Response.Headers.Add("Cache-Control", "max-age=120"); - Response.ContentType = "image"; - - return BlogPostPublicAppService.GetCoverImageAsync(id); - } - [HttpGet] [Route("{blogSlug}")] public virtual Task> GetListAsync(string blogSlug, PagedAndSortedResultRequestDto input) diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs index 28e3daea8d..3cd7c3bce0 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostAdminAppService_Tests.cs @@ -156,28 +156,5 @@ namespace Volo.CmsKit.Blogs exception.EntityType.ShouldBe(typeof(BlogPost)); exception.Id.ShouldBe(cmsKitTestData.Page_2_Id); } - - [Fact] - public async Task SetCoverImage_ShouldNotThrowException_WithCorrectData() - { - using (var imageStream = GetSampleImageStream()) - { - await WithUnitOfWorkAsync(async () => - { - await blogPostAdminAppService.SetCoverImageAsync( - cmsKitTestData.BlogPost_2_Id, - new RemoteStreamContent(imageStream)); - }); - } - } - - private Stream GetSampleImageStream() - { - var assembly = GetType().Assembly; - var resourceName = "Volo.CmsKit.Data.BlogPostSample.png"; - - return assembly.GetManifestResourceStream(resourceName); - } - // SetCoverImage } } From 316fdb63eaf3b55a0c2f93b1dd848220c6759197 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Fri, 5 Mar 2021 14:52:40 +0300 Subject: [PATCH 081/101] fix router events service intro --- docs/en/UI/Angular/Router-Events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Router-Events.md b/docs/en/UI/Angular/Router-Events.md index 011d405b22..1d36c3a211 100644 --- a/docs/en/UI/Angular/Router-Events.md +++ b/docs/en/UI/Angular/Router-Events.md @@ -1,6 +1,6 @@ # Router Events Simplified -`RouterEvents` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.io/guide/template-syntax#ngfor-with-trackby) for its purpose. +`RouterEvents` is a utility service for filtering specific router events and reacting to them. Please see [this page in Angular docs](https://angular.io/api/router/Event) for available router events. From 74e4184b0ad0e911e5134dbd440964ad4070f230 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 14:59:16 +0300 Subject: [PATCH 082/101] CmsKit - Implement CoverImage to Admin side --- .../CmsKit/Admin/Blogs/UpdateBlogPostDto.cs | 2 + .../Admin/Blogs/BlogPostAdminAppService.cs | 3 +- .../Pages/CmsKit/BlogPosts/Create.cshtml.cs | 3 ++ .../Pages/CmsKit/BlogPosts/Update.cshtml | 2 +- .../Pages/CmsKit/BlogPosts/Update.cshtml.cs | 3 ++ .../Pages/CmsKit/BlogPosts/create.js | 36 ++++++++------- .../Pages/CmsKit/BlogPosts/update.js | 45 ++++++++++--------- 7 files changed, 53 insertions(+), 41 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs index 7aaf775427..f4ed8aea5d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs @@ -21,5 +21,7 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } + + public Guid? CoverImage { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 2a8fc1955f..38b2b7a3b5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -35,7 +35,6 @@ namespace Volo.CmsKit.Admin.Blogs BlogPostRepository = blogPostRepository; BlogRepository = blogRepository; UserLookupService = userLookupService; - } [Authorize(CmsKitAdminPermissions.BlogPosts.Create)] @@ -67,6 +66,7 @@ namespace Volo.CmsKit.Admin.Blogs blogPost.SetTitle(input.Title); blogPost.SetShortDescription(input.ShortDescription); blogPost.SetContent(input.Content); + blogPost.CoverImage = input.CoverImage; if (blogPost.Slug != input.Slug) { @@ -78,7 +78,6 @@ namespace Volo.CmsKit.Admin.Blogs return ObjectMapper.Map(blogPost); } - [Authorize(CmsKitAdminPermissions.BlogPosts.Default)] public virtual async Task GetAsync(Guid id) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs index 2d3c7d36ab..2774b0528b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs @@ -62,6 +62,9 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts [HiddenInput] [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } + + [HiddenInput] + public Guid? CoverImage { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml index 7c56152b8e..b4386af860 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml @@ -45,7 +45,7 @@
- +
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs index 5fef40f8a1..69d29fff8f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs @@ -76,6 +76,9 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts [HiddenInput] [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } + + [HiddenInput] + public Guid? CoverImage { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index 977c90fde0..e4225aa3dc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -6,6 +6,7 @@ var $formCreate = $('#form-blog-post-create'); var $title = $('#ViewModel_Title'); var $shortDescription = $('#ViewModel_ShortDescription'); + var $coverImage = $('#ViewModel_CoverImage'); var $url = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-create'); var $pageContentInput = $('#ViewModel_Content'); @@ -13,7 +14,6 @@ var $fileInput = $('#BlogPostCoverImage'); var $tagsWrapper = $('#blog-post-tags-wrapper'); - var UPPY_UPLOAD_ENDPOINT = "/api/cms-kit-admin/blogs/blog-posts/{0}/cover-image"; var UPPY_FILE_ID = "uppy-upload-file"; var isTagsEnabled = true; @@ -37,15 +37,13 @@ if ($formCreate.valid()) { - abp.ui.setBusy(); - $formCreate.ajaxSubmit({ success: function (result) { if (isTagsEnabled) { submitEntityTags(result.id); } else { - submitCoverImage(result.id); + finishSaving(); } }, error: function (result) { @@ -54,22 +52,24 @@ } }); } + else { + abp.ui.clearBusy(); + } }); $buttonSubmit.click(function (e) { e.preventDefault(); - $formCreate.submit(); + submitCoverImage(); }); - + function submitEntityTags(blogPostId) { var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); - - if(tags.length === 0){ - submitCoverImage(blogPostId); + + if (tags.length === 0) { return; } - + volo.cmsKit.admin.tags.entityTagAdmin .setEntityTags({ entityType: 'BlogPost', @@ -77,7 +77,7 @@ tags: tags }) .then(function (result) { - submitCoverImage(blogPostId); + finishSaving(); }); } @@ -88,9 +88,11 @@ return headers; } - function submitCoverImage(blogPostId) { + function submitCoverImage() { + abp.ui.setBusy(); + var UPPY_OPTIONS = { - endpoint: UPPY_UPLOAD_ENDPOINT.replace("{0}", blogPostId), + endpoint: fileUploadUri, formData: true, fieldName: "file", method: "post", @@ -116,12 +118,14 @@ if (result.failed.length > 0) { abp.message.error(l("UploadFailedMessage")); } else { - finishSaving(); + $coverImage.val(result.successful[0].response.body.id); + + $formCreate.submit(); } }); } else { - finishSaving(); + $formCreate.submit(); } } @@ -201,7 +205,7 @@ } }); }); - + // ----------------------------------- var fileUploadUri = "/api/cms-kit-admin/media/blogpost"; var fileUriPrefix = "/api/cms-kit/media/"; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index ee6da62f6a..867aa158e7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -4,21 +4,19 @@ var $selectBlog = $('#BlogSelectionSelect'); var $formUpdate = $('#form-blog-post-update'); - var $title = $('#ViewModel_Title'); - var $titleClone = $('#title-clone'); + var $coverImage = $('#ViewModel_CoverImage'); var $slug = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-update'); var $blogPostIdInput = $('#Id'); var $tagsInput = $('.tag-editor-form input[name=tags]'); var $fileInput = $('#BlogPostCoverImage'); - var UPPY_UPLOAD_ENDPOINT = "/api/cms-kit-admin/blogs/blog-posts/{0}/cover-image"; var UPPY_FILE_ID = "uppy-upload-file"; var isTagsEnabled = true; - + $formUpdate.data('validator').settings.ignore = ":hidden, [contenteditable='true']:not([name]), .tui-popup-wrapper"; - + function initSelectBlog() { $selectBlog.data('autocompleteApiUrl', '/api/cms-kit-admin/blogs/blogs'); $selectBlog.data('autocompleteDisplayProperty', 'name'); @@ -44,30 +42,33 @@ submitEntityTags($blogPostIdInput.val()); } else { - submitCoverImage($blogPostIdInput.val()); + finishSaving(result); } }, error: function (result) { - abp.ui.clearBusy(); abp.notify.error(result.responseJSON.error.message); + abp.ui.clearBusy(); + abp.notify.error(result.responseJSON.error.message); } }); } + else { + abp.ui.clearBusy(); + } }); $buttonSubmit.click(function (e) { e.preventDefault(); - $formUpdate.submit(); + submitCoverImage(); }); - - function submitEntityTags(blogPostId) { + + function submitEntityTags(blogPostId) { var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); - if(tags.length === 0){ - submitCoverImage(blogPostId); + if (tags.length === 0) { return; } - + volo.cmsKit.admin.tags.entityTagAdmin .setEntityTags({ entityType: 'BlogPost', @@ -75,7 +76,7 @@ tags: tags }) .then(function (result) { - submitCoverImage(blogPostId); + finishSaving(); }); } @@ -86,9 +87,11 @@ return headers; } - function submitCoverImage(blogPostId) { + function submitCoverImage() { + abp.ui.setBusy(); + var UPPY_OPTIONS = { - endpoint: UPPY_UPLOAD_ENDPOINT.replace("{0}", blogPostId), + endpoint: fileUploadUri, formData: true, fieldName: "file", method: "post", @@ -114,12 +117,14 @@ if (result.failed.length > 0) { abp.message.error(l("UploadFailedMessage")); } else { - finishSaving(); + $coverImage.val(result.successful[0].response.body.id); + + $formUpdate.submit(); } }); } else { - finishSaving(); + $formUpdate.submit(); } } @@ -129,10 +134,6 @@ location.href = "../../BlogPosts"; } - $titleClone.on('change paste keyup', function () { - $title.val($titleClone.val()); - }); - $slug.on('change', function () { reflectUrlChanges(); }); From b4c3b119cc51de281b70f44f60a636d928897f0e Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 15:09:36 +0300 Subject: [PATCH 083/101] CmsKit - Implement BLogPost Cover-image to public site --- .../Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs | 4 +++- .../Components/Blogs/BlogPost/Default.cshtml | 10 ++++++---- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs index a7358f176a..3b762227e3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs @@ -16,7 +16,9 @@ namespace Volo.CmsKit.Public.Blogs public string ShortDescription { get; set; } public string Content { get; set; } - + + public Guid? CoverImage { get; set; } + public CmsUserDto Author { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml index f5c1bdc3a5..282f8f36cb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -4,14 +4,16 @@ @inject IStringLocalizer L -

@Model.Title

+@{ + const string dummyImageSource = "https://dummyimage.com/300x200/a3a3a3/fff.png"; +} - + + + @Model.Title @Model.Author?.UserName - - @Html.Raw(Model.Content) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 34f6a456d5..61bf30b8a0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -1,12 +1,16 @@ @page @using Volo.CmsKit.Public.Web.Pages -@using Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs +@using Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs @inherits CmsKitPublicPageBase @model IndexModel +@{ + const string dummyImageSource = "https://dummyimage.com/300x200/a3a3a3/fff.png"; +} + @foreach (var blog in Model.Blogs.Items) { @@ -21,7 +25,14 @@ - + @if (blog.CoverImage != null) + { + + } + else + { + + } @blog.ShortDescription From 0933640a215e4a142e4f3b653b1b59078d8a1f10 Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 5 Mar 2021 15:32:51 +0300 Subject: [PATCH 084/101] CmsKit - Rename CoverImage as CoverImageMediaId --- ...er.cs => 20210305122554_BlogPost_CoverImage.Designer.cs} | 4 ++-- ..._CoverImage.cs => 20210305122554_BlogPost_CoverImage.cs} | 4 ++-- .../Migrations/UnifiedDbContextModelSnapshot.cs | 2 +- .../Volo/CmsKit/Admin/Blogs/BlogPostDto.cs | 2 +- .../Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs | 2 +- .../Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs | 2 +- .../Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs | 4 ++-- .../Pages/CmsKit/BlogPosts/Create.cshtml.cs | 2 +- .../Pages/CmsKit/BlogPosts/Update.cshtml | 2 +- .../Pages/CmsKit/BlogPosts/Update.cshtml.cs | 2 +- .../Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js | 2 +- .../Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js | 2 +- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs | 6 +++--- .../Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs | 4 ++-- .../Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs | 2 +- .../CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml | 2 +- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 4 ++-- 17 files changed, 24 insertions(+), 24 deletions(-) rename modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/{20210305104055_BlogPost_CoverImage.Designer.cs => 20210305122554_BlogPost_CoverImage.Designer.cs} (99%) rename modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/{20210305104055_BlogPost_CoverImage.cs => 20210305122554_BlogPost_CoverImage.cs} (96%) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.Designer.cs similarity index 99% rename from modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs rename to modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.Designer.cs index 506e8cf2db..5fc4f4221d 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.Designer.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.Designer.cs @@ -11,7 +11,7 @@ using Volo.CmsKit.EntityFrameworkCore; namespace Volo.CmsKit.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20210305104055_BlogPost_CoverImage")] + [Migration("20210305122554_BlogPost_CoverImage")] partial class BlogPost_CoverImage { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -1275,7 +1275,7 @@ namespace Volo.CmsKit.Migrations .HasMaxLength(2147483647) .HasColumnType("nvarchar(max)"); - b.Property("CoverImage") + b.Property("CoverImageMediaId") .HasColumnType("uniqueidentifier"); b.Property("CreationTime") diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.cs similarity index 96% rename from modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs rename to modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.cs index 4e68ebb210..4345b9ec88 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305104055_BlogPost_CoverImage.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20210305122554_BlogPost_CoverImage.cs @@ -11,7 +11,7 @@ namespace Volo.CmsKit.Migrations name: "CmsContents"); migrationBuilder.AddColumn( - name: "CoverImage", + name: "CoverImageMediaId", table: "CmsBlogPosts", type: "uniqueidentifier", nullable: true); @@ -20,7 +20,7 @@ namespace Volo.CmsKit.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( - name: "CoverImage", + name: "CoverImageMediaId", table: "CmsBlogPosts"); migrationBuilder.CreateTable( diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index bd046eeb03..ad5c7ef888 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1273,7 +1273,7 @@ namespace Volo.CmsKit.Migrations .HasMaxLength(2147483647) .HasColumnType("nvarchar(max)"); - b.Property("CoverImage") + b.Property("CoverImageMediaId") .HasColumnType("uniqueidentifier"); b.Property("CreationTime") diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs index 66c9b9ac95..20e573bac1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostDto.cs @@ -16,6 +16,6 @@ namespace Volo.CmsKit.Admin.Blogs public string Content { get; set; } - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs index 39486ab356..1cae41512c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/CreateBlogPostDto.cs @@ -25,6 +25,6 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs index f4ed8aea5d..d0619288fe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/UpdateBlogPostDto.cs @@ -22,6 +22,6 @@ namespace Volo.CmsKit.Admin.Blogs [DynamicMaxLength(typeof(BlogPostConsts), nameof(BlogPostConsts.MaxContentLength))] public string Content { get; set; } - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 38b2b7a3b5..1d273f6a9c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -51,7 +51,7 @@ namespace Volo.CmsKit.Admin.Blogs input.Slug, input.ShortDescription, input.Content, - input.CoverImage); + input.CoverImageMediaId); await BlogPostRepository.InsertAsync(blogPost); @@ -66,7 +66,7 @@ namespace Volo.CmsKit.Admin.Blogs blogPost.SetTitle(input.Title); blogPost.SetShortDescription(input.ShortDescription); blogPost.SetContent(input.Content); - blogPost.CoverImage = input.CoverImage; + blogPost.CoverImageMediaId = input.CoverImageMediaId; if (blogPost.Slug != input.Slug) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs index 2774b0528b..7b6680c3c2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml.cs @@ -64,7 +64,7 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts public string Content { get; set; } [HiddenInput] - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml index b4386af860..7a2ecab760 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml @@ -45,7 +45,7 @@
- +
diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs index 69d29fff8f..e862c34d43 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml.cs @@ -78,7 +78,7 @@ namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.BlogPosts public string Content { get; set; } [HiddenInput] - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index e4225aa3dc..378ab3f4da 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -6,7 +6,7 @@ var $formCreate = $('#form-blog-post-create'); var $title = $('#ViewModel_Title'); var $shortDescription = $('#ViewModel_ShortDescription'); - var $coverImage = $('#ViewModel_CoverImage'); + var $coverImage = $('#ViewModel_CoverImageMediaId'); var $url = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-create'); var $pageContentInput = $('#ViewModel_Content'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 867aa158e7..84754bd316 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -4,7 +4,7 @@ var $selectBlog = $('#BlogSelectionSelect'); var $formUpdate = $('#form-blog-post-update'); - var $coverImage = $('#ViewModel_CoverImage'); + var $coverImage = $('#ViewModel_CoverImageMediaId'); var $slug = $('#ViewModel_Slug'); var $buttonSubmit = $('#button-blog-post-update'); var $blogPostIdInput = $('#Id'); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs index c1e5bba2d9..7dda50ca9a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPost.cs @@ -23,7 +23,7 @@ namespace Volo.CmsKit.Blogs public virtual string Content { get; protected set; } - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } public virtual Guid? TenantId { get; protected set; } @@ -43,7 +43,7 @@ namespace Volo.CmsKit.Blogs [NotNull] string slug, [CanBeNull] string shortDescription = null, [CanBeNull] string content = null, - [CanBeNull] Guid? coverImage = null, + [CanBeNull] Guid? coverImageMediaId = null, [CanBeNull] Guid? tenantId = null) : base(id) { TenantId = tenantId; @@ -53,7 +53,7 @@ namespace Volo.CmsKit.Blogs SetSlug(slug); SetShortDescription(shortDescription); SetContent(content); - CoverImage = coverImage; + CoverImageMediaId = coverImageMediaId; } public virtual void SetTitle(string title) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs index bf5e9ef936..cce076b74b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/BlogPostManager.cs @@ -28,7 +28,7 @@ namespace Volo.CmsKit.Blogs [NotNull] string slug, [CanBeNull] string shortDescription = null, [CanBeNull] string content = null, - [CanBeNull] Guid? coverImage = null) + [CanBeNull] Guid? coverImageMediaId = null) { Check.NotNull(author, nameof(author)); Check.NotNull(blog, nameof(blog)); @@ -45,7 +45,7 @@ namespace Volo.CmsKit.Blogs slug, shortDescription, content, - coverImage, + coverImageMediaId, CurrentTenant.Id ); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs index 3b762227e3..b2b3cc88e0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostPublicDto.cs @@ -17,7 +17,7 @@ namespace Volo.CmsKit.Public.Blogs public string Content { get; set; } - public Guid? CoverImage { get; set; } + public Guid? CoverImageMediaId { get; set; } public CmsUserDto Author { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml index 282f8f36cb..46f7749d8b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -9,7 +9,7 @@ } - + @Model.Title @Model.Author?.UserName diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 61bf30b8a0..b58e6d1543 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -25,9 +25,9 @@ - @if (blog.CoverImage != null) + @if (blog.CoverImageMediaId != null) { - + } else { From 859c4e9a6c32ee51d910715715633709e9e831eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 5 Mar 2021 17:11:51 +0300 Subject: [PATCH 085/101] Resolves #7965: Logging on Service Registration. --- .../ServiceCollectionLoggingExtensions.cs | 12 +++++++++ .../Volo/Abp/AbpApplicationBase.cs | 21 +++++++++++++++ .../InternalServiceCollectionExtensions.cs | 2 ++ .../Volo/Abp/Logging/AbpInitLogEntry.cs | 26 +++++++++++++++++++ .../Volo/Abp/Logging/DefaultInitLogger.cs | 24 +++++++++++++++++ .../Volo/Abp/Logging/IInitLogger.cs | 16 ++++++++++++ .../Volo/Abp/Modularity/AbpModuleHelper.cs | 16 +++++++++--- .../Volo/Abp/Modularity/ModuleLoader.cs | 7 +++-- .../Volo/Abp/Modularity/ModuleManager.cs | 12 --------- .../PlugIns/PlugInSourceExtensions.cs | 5 ++-- .../Modularity/PlugIns/PlugInSourceList.cs | 5 ++-- .../Volo/Abp/Modularity/ModuleLoader_Tests.cs | 8 +++++- 12 files changed, 131 insertions(+), 23 deletions(-) create mode 100644 framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs new file mode 100644 index 0000000000..48921cb99b --- /dev/null +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Logging; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class ServiceCollectionLoggingExtensions + { + public static IInitLogger GetInitLogger(this IServiceCollection services) + { + return services.GetSingletonInstance(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs index 1e5b251ca0..256a1dd05d 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Volo.Abp.DependencyInjection; using Volo.Abp.Internal; +using Volo.Abp.Logging; using Volo.Abp.Modularity; namespace Volo.Abp @@ -71,11 +73,30 @@ namespace Volo.Abp { using (var scope = ServiceProvider.CreateScope()) { + WriteInitLogs(scope.ServiceProvider); scope.ServiceProvider .GetRequiredService() .InitializeModules(new ApplicationInitializationContext(scope.ServiceProvider)); } } + + protected virtual void WriteInitLogs(IServiceProvider serviceProvider) + { + var logger = serviceProvider.GetService>(); + if (logger == null) + { + return; + } + + var initLogger = serviceProvider.GetRequiredService(); + + foreach (var entry in initLogger.Entries) + { + logger.LogWithLevel(entry.Level, entry.Message, entry.Exception); + } + + initLogger.Entries.Clear(); + } protected virtual IReadOnlyList LoadModules(IServiceCollection services, AbpApplicationCreationOptions options) { diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs index 83a7ec163e..c116a20080 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.Logging; using Volo.Abp.Modularity; using Volo.Abp.Reflection; @@ -35,6 +36,7 @@ namespace Volo.Abp.Internal services.TryAddSingleton(moduleLoader); services.TryAddSingleton(assemblyFinder); services.TryAddSingleton(typeFinder); + services.TryAddSingleton(new DefaultInitLogger()); services.AddAssemblyOf(); diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs new file mode 100644 index 0000000000..17a346fa1c --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs @@ -0,0 +1,26 @@ +using System; +using JetBrains.Annotations; +using Microsoft.Extensions.Logging; + +namespace Volo.Abp.Logging +{ + public class AbpInitLogEntry + { + public LogLevel Level { get; } + + public string Message { get; } + + [CanBeNull] + public Exception Exception { get; } + + public AbpInitLogEntry( + LogLevel level, + string message, + Exception exception) + { + Level = level; + Message = message; + Exception = exception; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs new file mode 100644 index 0000000000..e1f7344f39 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; + +namespace Volo.Abp.Logging +{ + public class DefaultInitLogger : IInitLogger + { + public List Entries { get; } + + public DefaultInitLogger() + { + Entries = new List(); + } + + public void Log( + LogLevel logLevel, + string message, + Exception exception = null) + { + Entries.Add(new AbpInitLogEntry(logLevel, message, exception)); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs new file mode 100644 index 0000000000..5c549682e9 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; + +namespace Volo.Abp.Logging +{ + public interface IInitLogger + { + public List Entries { get; } + + void Log( + LogLevel logLevel, + string message, + Exception exception = null); + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs index d58483811b..9331014623 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs @@ -2,15 +2,18 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using Microsoft.Extensions.Logging; +using Volo.Abp.Logging; namespace Volo.Abp.Modularity { internal static class AbpModuleHelper { - public static List FindAllModuleTypes(Type startupModuleType) + public static List FindAllModuleTypes(Type startupModuleType, IInitLogger logger) { var moduleTypes = new List(); - AddModuleAndDependenciesResursively(moduleTypes, startupModuleType); + logger.Log(LogLevel.Information, "Loaded ABP modules:"); + AddModuleAndDependenciesResursively(moduleTypes, startupModuleType, logger); return moduleTypes; } @@ -35,7 +38,11 @@ namespace Volo.Abp.Modularity return dependencies; } - private static void AddModuleAndDependenciesResursively(List moduleTypes, Type moduleType) + private static void AddModuleAndDependenciesResursively( + List moduleTypes, + Type moduleType, + IInitLogger logger, + int depth = 0) { AbpModule.CheckAbpModuleType(moduleType); @@ -45,10 +52,11 @@ namespace Volo.Abp.Modularity } moduleTypes.Add(moduleType); + logger.Log(LogLevel.Information, $"{new string(' ', depth * 2)}- {moduleType.FullName}"); foreach (var dependedModuleType in FindDependedModuleTypes(moduleType)) { - AddModuleAndDependenciesResursively(moduleTypes, dependedModuleType); + AddModuleAndDependenciesResursively(moduleTypes, dependedModuleType, logger, depth + 1); } } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs index 7e7e69d457..56ee2f5d71 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Logging; using Volo.Abp.Modularity.PlugIns; namespace Volo.Abp.Modularity @@ -43,14 +44,16 @@ namespace Volo.Abp.Modularity Type startupModuleType, PlugInSourceList plugInSources) { + var initLogger = services.GetInitLogger(); + //All modules starting from the startup module - foreach (var moduleType in AbpModuleHelper.FindAllModuleTypes(startupModuleType)) + foreach (var moduleType in AbpModuleHelper.FindAllModuleTypes(startupModuleType, initLogger)) { modules.Add(CreateModuleDescriptor(services, moduleType)); } //Plugin modules - foreach (var moduleType in plugInSources.GetAllModules()) + foreach (var moduleType in plugInSources.GetAllModules(initLogger)) { if (modules.Any(m => m.Type == moduleType)) { diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleManager.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleManager.cs index 70b9036150..764acf1289 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleManager.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleManager.cs @@ -32,8 +32,6 @@ namespace Volo.Abp.Modularity public void InitializeModules(ApplicationInitializationContext context) { - LogListOfModules(); - foreach (var contributor in _lifecycleContributors) { foreach (var module in _moduleContainer.Modules) @@ -52,16 +50,6 @@ namespace Volo.Abp.Modularity _logger.LogInformation("Initialized all ABP modules."); } - private void LogListOfModules() - { - _logger.LogInformation("Loaded ABP modules:"); - - foreach (var module in _moduleContainer.Modules) - { - _logger.LogInformation("- " + module.Type.FullName); - } - } - public void ShutdownModules(ApplicationShutdownContext context) { var modules = _moduleContainer.Modules.Reverse().ToList(); diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs index bf44f94605..b041cd160d 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs @@ -1,19 +1,20 @@ using System; using System.Linq; using JetBrains.Annotations; +using Volo.Abp.Logging; namespace Volo.Abp.Modularity.PlugIns { public static class PlugInSourceExtensions { [NotNull] - public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource) + public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource, IInitLogger logger) { Check.NotNull(plugInSource, nameof(plugInSource)); return plugInSource .GetModules() - .SelectMany(AbpModuleHelper.FindAllModuleTypes) + .SelectMany(type => AbpModuleHelper.FindAllModuleTypes(type, logger)) .Distinct() .ToArray(); } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs index 1e96e26e14..1d5509b359 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs @@ -2,16 +2,17 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; +using Volo.Abp.Logging; namespace Volo.Abp.Modularity.PlugIns { public class PlugInSourceList : List { [NotNull] - internal Type[] GetAllModules() + internal Type[] GetAllModules(IInitLogger logger) { return this - .SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies()) + .SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies(logger)) .Distinct() .ToArray(); } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs index 3541f9b78e..cc0117e184 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Shouldly; +using Volo.Abp.Logging; using Volo.Abp.Modularity.PlugIns; using Xunit; @@ -11,7 +12,12 @@ namespace Volo.Abp.Modularity public void Should_Load_Modules_By_Dependency_Order() { var moduleLoader = new ModuleLoader(); - var modules = moduleLoader.LoadModules(new ServiceCollection(), typeof(MyStartupModule), new PlugInSourceList()); + var modules = moduleLoader.LoadModules( + new ServiceCollection() + .AddSingleton(new DefaultInitLogger()), + typeof(MyStartupModule), + new PlugInSourceList() + ); modules.Length.ShouldBe(2); modules[0].Type.ShouldBe(typeof(IndependentEmptyModule)); modules[1].Type.ShouldBe(typeof(MyStartupModule)); From 00a22cb0bb7ae337722129875a8ff2aa74ea86df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 5 Mar 2021 17:16:05 +0300 Subject: [PATCH 086/101] CmsKitHttpApiModule should not depend on applicatin layers. --- .../src/Volo.CmsKit.HttpApi/Volo.CmsKit.HttpApi.csproj | 4 ++-- .../Volo.CmsKit.HttpApi/Volo/CmsKit/CmsKitHttpApiModule.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo.CmsKit.HttpApi.csproj b/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo.CmsKit.HttpApi.csproj index 64a3dcef21..b23ef3ba0e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo.CmsKit.HttpApi.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo.CmsKit.HttpApi.csproj @@ -9,9 +9,9 @@ - + - + diff --git a/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo/CmsKit/CmsKitHttpApiModule.cs b/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo/CmsKit/CmsKitHttpApiModule.cs index c4a45bb8cf..219f2d9442 100644 --- a/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo/CmsKit/CmsKitHttpApiModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.HttpApi/Volo/CmsKit/CmsKitHttpApiModule.cs @@ -5,8 +5,8 @@ using Volo.CmsKit.Public; namespace Volo.CmsKit { [DependsOn( - typeof(CmsKitAdminApplicationModule), - typeof(CmsKitPublicApplicationModule), + typeof(CmsKitAdminHttpApiModule), + typeof(CmsKitPublicHttpApiModule), typeof(CmsKitApplicationContractsModule) )] public class CmsKitHttpApiModule : AbpModule From 460e38f6542d212e189731e7a769799cd92a65a7 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 7 Mar 2021 10:20:08 +0800 Subject: [PATCH 087/101] Make IInitLogger inherit ILogger. --- .../ServiceCollectionLoggingExtensions.cs | 9 +++--- .../Volo/Abp/AbpApplicationBase.cs | 18 +++++------ .../InternalServiceCollectionExtensions.cs | 6 ++-- .../Volo/Abp/Logging/AbpInitLogEntry.cs | 30 ++++++++----------- .../Volo/Abp/Logging/DefaultInitLogger.cs | 30 ++++++++++++++----- .../Volo/Abp/Logging/IInitLogger.cs | 12 ++------ .../Volo/Abp/Logging/IInitLoggerFactory.cs | 7 +++++ .../Volo/Abp/Logging/InitLoggerFactory.cs | 15 ++++++++++ .../Volo/Abp/Modularity/AbpModuleHelper.cs | 5 ++-- .../Volo/Abp/Modularity/ModuleLoader.cs | 13 ++++---- .../PlugIns/PlugInSourceExtensions.cs | 5 ++-- .../Modularity/PlugIns/PlugInSourceList.cs | 6 ++-- .../Volo/Abp/Modularity/ModuleLoader_Tests.cs | 4 +-- 13 files changed, 92 insertions(+), 68 deletions(-) create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLoggerFactory.cs create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs index 48921cb99b..e31e7cbf51 100644 --- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs +++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/DependencyInjection/ServiceCollectionLoggingExtensions.cs @@ -1,12 +1,13 @@ -using Volo.Abp.Logging; +using Microsoft.Extensions.Logging; +using Volo.Abp.Logging; namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionLoggingExtensions { - public static IInitLogger GetInitLogger(this IServiceCollection services) + public static ILogger GetInitLogger(this IServiceCollection services) { - return services.GetSingletonInstance(); + return services.GetSingletonInstance().Create(); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs index 256a1dd05d..61cee2ce90 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs @@ -62,7 +62,7 @@ namespace Volo.Abp { //TODO: Shutdown if not done before? } - + protected virtual void SetServiceProvider(IServiceProvider serviceProvider) { ServiceProvider = serviceProvider; @@ -79,7 +79,7 @@ namespace Volo.Abp .InitializeModules(new ApplicationInitializationContext(scope.ServiceProvider)); } } - + protected virtual void WriteInitLogs(IServiceProvider serviceProvider) { var logger = serviceProvider.GetService>(); @@ -87,14 +87,14 @@ namespace Volo.Abp { return; } - - var initLogger = serviceProvider.GetRequiredService(); - + + var initLogger = serviceProvider.GetRequiredService().Create(); + foreach (var entry in initLogger.Entries) { - logger.LogWithLevel(entry.Level, entry.Message, entry.Exception); + logger.Log(entry.LogLevel, entry.EventId, entry.State, entry.Exception, entry.Formatter); } - + initLogger.Entries.Clear(); } @@ -108,7 +108,7 @@ namespace Volo.Abp options.PlugInSources ); } - + //TODO: We can extract a new class for this protected virtual void ConfigureServices() { @@ -179,4 +179,4 @@ namespace Volo.Abp } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs index c116a20080..476670b98c 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Internal } internal static void AddCoreAbpServices(this IServiceCollection services, - IAbpApplication abpApplication, + IAbpApplication abpApplication, AbpApplicationCreationOptions applicationCreationOptions) { var moduleLoader = new ModuleLoader(); @@ -36,7 +36,7 @@ namespace Volo.Abp.Internal services.TryAddSingleton(moduleLoader); services.TryAddSingleton(assemblyFinder); services.TryAddSingleton(typeFinder); - services.TryAddSingleton(new DefaultInitLogger()); + services.TryAddSingleton(new InitLoggerFactory()); services.AddAssemblyOf(); @@ -49,4 +49,4 @@ namespace Volo.Abp.Internal }); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs index 17a346fa1c..da44f2be2b 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/AbpInitLogEntry.cs @@ -1,26 +1,20 @@ using System; -using JetBrains.Annotations; using Microsoft.Extensions.Logging; namespace Volo.Abp.Logging { public class AbpInitLogEntry { - public LogLevel Level { get; } - - public string Message { get; } - - [CanBeNull] - public Exception Exception { get; } - - public AbpInitLogEntry( - LogLevel level, - string message, - Exception exception) - { - Level = level; - Message = message; - Exception = exception; - } + public LogLevel LogLevel { get; set; } + + public EventId EventId { get; set; } + + public object State { get; set; } + + public Exception Exception { get; set; } + + public Func Formatter { get; set; } + + public string Message => Formatter(State, Exception); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs index e1f7344f39..2cc0963282 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLogger.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging; namespace Volo.Abp.Logging { - public class DefaultInitLogger : IInitLogger + public class DefaultInitLogger : IInitLogger { public List Entries { get; } @@ -12,13 +12,27 @@ namespace Volo.Abp.Logging { Entries = new List(); } - - public void Log( - LogLevel logLevel, - string message, - Exception exception = null) + + public virtual void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + Entries.Add(new AbpInitLogEntry + { + LogLevel = logLevel, + EventId = eventId, + State = state, + Exception = exception, + Formatter = (s, e) => formatter((TState)s, e), + }); + } + + public virtual bool IsEnabled(LogLevel logLevel) + { + return logLevel != LogLevel.None; + } + + public virtual IDisposable BeginScope(TState state) { - Entries.Add(new AbpInitLogEntry(logLevel, message, exception)); + return NullDisposable.Instance; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs index 5c549682e9..bcb578394f 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLogger.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Microsoft.Extensions.Logging; namespace Volo.Abp.Logging { - public interface IInitLogger + public interface IInitLogger : ILogger { public List Entries { get; } - - void Log( - LogLevel logLevel, - string message, - Exception exception = null); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLoggerFactory.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLoggerFactory.cs new file mode 100644 index 0000000000..91300f7967 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/IInitLoggerFactory.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Logging +{ + public interface IInitLoggerFactory + { + IInitLogger Create(); + } +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs new file mode 100644 index 0000000000..89005bee31 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Abp.Logging +{ + public class InitLoggerFactory : IInitLoggerFactory + { + private readonly Dictionary _cache = new Dictionary(); + + public virtual IInitLogger Create() + { + return (IInitLogger)_cache.GetOrAdd(typeof(T), () => new DefaultInitLogger());; + } + } +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs index 9331014623..e8bccb8e18 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModuleHelper.cs @@ -3,13 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.Extensions.Logging; -using Volo.Abp.Logging; namespace Volo.Abp.Modularity { internal static class AbpModuleHelper { - public static List FindAllModuleTypes(Type startupModuleType, IInitLogger logger) + public static List FindAllModuleTypes(Type startupModuleType, ILogger logger) { var moduleTypes = new List(); logger.Log(LogLevel.Information, "Loaded ABP modules:"); @@ -41,7 +40,7 @@ namespace Volo.Abp.Modularity private static void AddModuleAndDependenciesResursively( List moduleTypes, Type moduleType, - IInitLogger logger, + ILogger logger, int depth = 0) { AbpModule.CheckAbpModuleType(moduleType); diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs index 56ee2f5d71..3c5fb9aa56 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/ModuleLoader.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Logging; using Volo.Abp.Modularity.PlugIns; namespace Volo.Abp.Modularity @@ -26,7 +25,7 @@ namespace Volo.Abp.Modularity } private List GetDescriptors( - IServiceCollection services, + IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources) { @@ -44,16 +43,16 @@ namespace Volo.Abp.Modularity Type startupModuleType, PlugInSourceList plugInSources) { - var initLogger = services.GetInitLogger(); - + var logger = services.GetInitLogger(); + //All modules starting from the startup module - foreach (var moduleType in AbpModuleHelper.FindAllModuleTypes(startupModuleType, initLogger)) + foreach (var moduleType in AbpModuleHelper.FindAllModuleTypes(startupModuleType, logger)) { modules.Add(CreateModuleDescriptor(services, moduleType)); } //Plugin modules - foreach (var moduleType in plugInSources.GetAllModules(initLogger)) + foreach (var moduleType in plugInSources.GetAllModules(logger)) { if (modules.Any(m => m.Type == moduleType)) { @@ -105,4 +104,4 @@ namespace Volo.Abp.Modularity } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs index b041cd160d..92be156b69 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using JetBrains.Annotations; +using Microsoft.Extensions.Logging; using Volo.Abp.Logging; namespace Volo.Abp.Modularity.PlugIns @@ -8,7 +9,7 @@ namespace Volo.Abp.Modularity.PlugIns public static class PlugInSourceExtensions { [NotNull] - public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource, IInitLogger logger) + public static Type[] GetModulesWithAllDependencies([NotNull] this IPlugInSource plugInSource, ILogger logger) { Check.NotNull(plugInSource, nameof(plugInSource)); @@ -19,4 +20,4 @@ namespace Volo.Abp.Modularity.PlugIns .ToArray(); } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs index 1d5509b359..06c0187a32 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/PlugInSourceList.cs @@ -2,14 +2,14 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; -using Volo.Abp.Logging; +using Microsoft.Extensions.Logging; namespace Volo.Abp.Modularity.PlugIns { public class PlugInSourceList : List { [NotNull] - internal Type[] GetAllModules(IInitLogger logger) + internal Type[] GetAllModules(ILogger logger) { return this .SelectMany(pluginSource => pluginSource.GetModulesWithAllDependencies(logger)) @@ -17,4 +17,4 @@ namespace Volo.Abp.Modularity.PlugIns .ToArray(); } } -} \ No newline at end of file +} diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs index cc0117e184..4d45888eb3 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Modularity var moduleLoader = new ModuleLoader(); var modules = moduleLoader.LoadModules( new ServiceCollection() - .AddSingleton(new DefaultInitLogger()), + .AddSingleton(new InitLoggerFactory()), typeof(MyStartupModule), new PlugInSourceList() ); @@ -28,7 +28,7 @@ namespace Volo.Abp.Modularity { public override void ConfigureServices(ServiceConfigurationContext context) { - + } } } From e756fac8c56d5f2cf23db9742a2b7bd5bc650213 Mon Sep 17 00:00:00 2001 From: maliming Date: Sun, 7 Mar 2021 10:29:28 +0800 Subject: [PATCH 088/101] Rename InitLoggerFactory to DefaultInitLoggerFactory. --- .../Volo/Abp/Internal/InternalServiceCollectionExtensions.cs | 2 +- .../{InitLoggerFactory.cs => DefaultInitLoggerFactory.cs} | 2 +- .../Volo/Abp/Modularity/ModuleLoader_Tests.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename framework/src/Volo.Abp.Core/Volo/Abp/Logging/{InitLoggerFactory.cs => DefaultInitLoggerFactory.cs} (84%) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs index 476670b98c..ee06003204 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.Internal services.TryAddSingleton(moduleLoader); services.TryAddSingleton(assemblyFinder); services.TryAddSingleton(typeFinder); - services.TryAddSingleton(new InitLoggerFactory()); + services.TryAddSingleton(new DefaultInitLoggerFactory()); services.AddAssemblyOf(); diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLoggerFactory.cs similarity index 84% rename from framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs rename to framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLoggerFactory.cs index 89005bee31..cb2e5d4060 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Logging/InitLoggerFactory.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Logging/DefaultInitLoggerFactory.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace Volo.Abp.Logging { - public class InitLoggerFactory : IInitLoggerFactory + public class DefaultInitLoggerFactory : IInitLoggerFactory { private readonly Dictionary _cache = new Dictionary(); diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs index 4d45888eb3..4b7ed95e89 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Modularity/ModuleLoader_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Modularity var moduleLoader = new ModuleLoader(); var modules = moduleLoader.LoadModules( new ServiceCollection() - .AddSingleton(new InitLoggerFactory()), + .AddSingleton(new DefaultInitLoggerFactory()), typeof(MyStartupModule), new PlugInSourceList() ); From c2d9ffbe95bd9aa959b9f615bf643ae580466164 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Sun, 7 Mar 2021 14:14:13 +0300 Subject: [PATCH 089/101] Update en.json --- .../AbpIoLocalization/Community/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index 9c5ae26f89..47eb726dcb 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -138,6 +138,7 @@ "TwitterUserNameValidationMessage": "Your Twitter username can not include whitespace, please be sure your Twitter username is correct.", "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct.", "NoPostsFound": "No posts found!", - "SearchInPosts": "Search in posts..." + "SearchInPosts": "Search in posts...", + "MinimumSearchContent": "Minimum search content must be 3 letters!" } } From a1bb97fd6aa57e30ce36740c7c638b5dbc3f7289 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Sun, 7 Mar 2021 16:00:51 +0300 Subject: [PATCH 090/101] Update How-To-Add-Custom-Property-To-The-User-Entity.md --- .../How-To-Add-Custom-Property-To-The-User-Entity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md b/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md index 3e8a3e9da2..86f9774c7f 100644 --- a/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md +++ b/docs/en/Community-Articles/2020-10-08-How-To-Add-Custom-Property-To-The-User-Entity/How-To-Add-Custom-Property-To-The-User-Entity.md @@ -78,7 +78,7 @@ public static class CustomizeUserDemoEfCoreEntityExtensionMappings nameof(AppUser.Title), (entityBuilder, propertyBuilder) => { - propertyBuilder.IsRequired(); + propertyBuilder.HasDefaultValue(); propertyBuilder.HasMaxLength(UserConsts.MaxTitleLength); } ).MapEfCoreProperty( From c3e2f6680bbed87922d5e77567e3905e2b49b018 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 8 Mar 2021 16:16:30 +0800 Subject: [PATCH 091/101] Update Chinese localization --- .../Admin/Localization/Resources/zh-Hans.json | 25 +++- .../Localization/Resources/zh-Hans.json | 31 ++++- .../Www/Localization/Resources/zh-Hans.json | 7 +- .../Localization/zh-Hans.json | 6 +- .../Localization/Resources/zh-Hans.json | 122 ++++++++++++++++-- .../LocalizationExtensions/zh-Hans.json | 7 + 6 files changed, 180 insertions(+), 18 deletions(-) create mode 100644 modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/zh-Hans.json diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json index f5cbeb0213..7351fde5cb 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json @@ -35,6 +35,7 @@ "NameFilter": "名称", "CreationTime": "创建时间", "IsPro": "是否为专业版", + "IsFreeToActiveLicenseOwners": "许可证所有者免费", "ShowOnModuleList": "展示模块列表", "EfCoreConfigureMethodName": "配置方法法", "IsProFilter": "是否为专业版", @@ -90,6 +91,7 @@ "UserNotFound": "用户不存在", "{0}WillBeRemovedFromDevelopers": "{0} 将从开发者中移除, 你确定吗?", "{0}WillBeRemovedFromOwners": "{0} 将从所有者中移除, 你确定吗?", + "{0}WillBeRemovedFromMembers": "{0} 将从成员中删除, 你确定吗?", "Computers": "计算机", "UniqueComputerId": "计算机唯一ID", "LastSeenDate": "上次查看日期", @@ -194,6 +196,27 @@ "CoverImage": "封面图片", "RemoveCacheConfirmationMessage": "你确定要删除\"{0}\" 文章缓存?", "SuccessfullyRemoved": "清除成功", - "RemoveCache": "删除缓存" + "RemoveCache": "删除缓存", + "Language": "语言", + "Optional": "可选的", + "CreateArticleLanguageInfo": "发帖所用的语言", + "Enum:ContentSource:2": "视频发布", + "VideoPreview": "视频预览", + "VideoPreviewErrorMessage": "无法从YouTube获取给定的视频网址. 可能是由于视频是私有视频,或者给定的URL不可用.", + "DeleteCoverImage": "删除封面图片", + "DeleteCoverImageConfirmationMessage": "你确定要删除封面图片吗", + "DeleteCoverImageSuccessMessage": "成功删除封面图片", + "PaymentsOf": "付款的", + "ShowPaymentsOfOrganization": "显示付款", + "Date": "日期", + "Products": "商品", + "TotalAmount": "总金额", + "Currency": "货币", + "Gateway": "网关", + "State": "状态", + "FailReason": "失败原因", + "ReIndexAllPosts": "重新索引所有帖子", + "ReIndexAllPostsConfirmationMessage": "你确定要重新索引所有的帖子吗", + "SuccessfullyReIndexAllPosts": "成功索引所有的帖子" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json index 49b819227f..9d7b56f0f3 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/zh-Hans.json @@ -110,7 +110,34 @@ "VideoContentForm": "视频内容来源", "GithubPostForm": "Github文章来源", "ExternalPostForm": "外部文章来源", - "PostSourceTypeChooses": "我们接受文章的三种来源类型;", - "Posts": "文章" + "HowToPost": "如何发布", + "Posts": "文章", + "VideoUrl": "视频Url", + "GithubArticleUrl": "Github文章Url", + "ExternalArticleUrl": "外部文章Url", + "CreatePostCoverInfo": "要创建一个有效的帖子,需要添加封面图片. 上传16:9的图片获取最佳视觉效果. 文件最大支持: 1MB", + "ThankYouForContribution": "感谢你对ABP社区的贡献", + "GithubArticle": "Github文章", + "GithubArticleSubmitStepOne": "1. 用Markdown格式在GitHub的任何公共存储库上写一篇文章. 示例", + "GithubArticleSubmitStepTwo": "2. 使用表单提交你的文章URL.", + "GithubArticleSubmitStepThree": "3. 你的文章将在这个网站中呈现.", + "YoutubeVideo": "Youtube视频", + "YoutubeVideoSubmitStepOne": "1. 在YouTube上发布你的视频.", + "YoutubeVideoSubmitStepTwo": "2. 使用表单提交视频URL.", + "YoutubeVideoSubmitStepThree": "3. 访客将能够在这个网站上直接观看你的视频内容.", + "ExternalContent": "外部内容", + "ExternalContentSubmitStepOne": "1. 在任何公开的平台创建内容(medium, 你自己的博客或者任何你喜欢的).", + "ExternalContentSubmitStepTwo": "2. 使用表单提交内容URL.", + "ExternalContentSubmitStepThree": "3. 访客被重定向到原网站的内容.", + "ChooseYourContentType": "请选择你想要添加内容的方式", + "PostContentViaGithub": "我想要使用 GitHub提交markdown格式的文章", + "PostContentViaYoutube": "我想要分享我在 Youtube的可用视频", + "PostContentViaExternalSource": "我想要添加我在其他平台发布的内容", + "GitHubUserNameValidationMessage": "您的Github用户名不能包含空格, 请确认你的Github用户名是正确的.", + "PersonalSiteUrlValidationMessage": "你的个人网站URL不能包含空格, 请确定你的个人网站URL是正确的.", + "TwitterUserNameValidationMessage": "你的Twitter用户名不能包含空格, 请确认你的Twitter用户名是正确的.", + "LinkedinUrlValidationMessage": "你的领英URL不能包含空格, 请确认你的领英URL是正确的", + "NoPostsFound": "没有发现帖子", + "SearchInPosts": "搜索帖子…" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index e187a628f2..8185ead8cd 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -8,6 +8,7 @@ "ProjectName": "项目名称", "ProjectType": "项目类型", "DatabaseProvider": "数据库提供者", + "DatabaseManagementSystem": "数据库管理系统", "NTier": "N层", "IncludeUserInterface": "包含用户界面", "CreateNow": "现在创建", @@ -194,7 +195,7 @@ "MultipleUIOptionsExplanation": "核心框架设计为独立与UI,可以和任何类型的UI系统一起使用. 同时提供了多个开箱即用的预构建集成选项.", "MultipleDBOptionsExplanation": "该框架可以使用任何数据源,并且以下提供程序已得到正式开发和支持;", "SelectLanguage": "选择语言", - "LatestArticleOnCommunity": "关于ABP社区的最新文章", - "Register": "寄存器" + "LatestArticleOnCommunity": "关于ABP社区的最新文章", + "Register": "寄存器" } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/zh-Hans.json b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/zh-Hans.json index e9843def1b..c5c7783381 100644 --- a/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/zh-Hans.json +++ b/framework/src/Volo.Abp.ExceptionHandling/Volo/Abp/ExceptionHandling/Localization/zh-Hans.json @@ -18,6 +18,8 @@ "401Message": "未授权", "403Message": "禁止访问", "404Message": "网页未找到", - "500Message": "内部服务器错误" + "500Message": "内部服务器错误", + "403MessageDetail": "您没有权限执行此操作", + "404MessageDetail": "抱歉, 这个地址是空的" } -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json index d65eb1c886..64ed439d50 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/zh-Hans.json @@ -1,22 +1,124 @@ { "culture": "zh-Hans", "texts": { - "PickYourReaction": "选择你的回应", - "YourComment": "你的评论", - "YourReply": "你的回复", + "BlogDeletionConfirmationMessage": "博客 '{0}' 将被删除. 你确定吗?", + "BlogFeatureNotAvailable": "这个功能目前不可用. 使用 `GlobalFeatureManager` 来启用它.", + "BlogId": "博客", + "BlogPostDeletionConfirmationMessage": "博客帖子 '{0}' 将被删除. 你确定吗?", + "BlogPosts": "博客帖子", + "Blogs": "博客", + "ChoosePreference": "选择首选项...", + "Cms": "Cms", + "CmsKit.Comments": "评论", + "CmsKit.Ratings": "评分", + "CmsKit.Reactions": "反应", + "CmsKit.Tags": "标签", + "CmsKit:0002": "内容已经存在!", + "CmsKit:0003": "实体 {0} 不可标记.", + "CmsKit:Blog:0001": "给定的slug ({Slug}) 已经存在!", + "CmsKit:BlogPost:0001": "给定的slug已经存在!", + "CmsKit:Comments:0001": "实体不可 {0} 不可评论.", + "CmsKit:Media:0001": "'{Name}' 不是有效的媒体名称.", + "CmsKit:Media:0002": "实体不可以含有媒体", + "CmsKit:Page:0001": "给定的url ({0}) 已经存在.", + "CmsKit:Tag:0002": "实体不可标记!", + "CommentAuthorizationExceptionMessage": "这些评论不允许公开显示", + "CommentDeletionConfirmationMessage": "此评论和所有回复将被删除!", "Comments": "评论", - "Send": "发送", + "ContentDeletionConfirmationMessage": "你确定要删除这个内容吗?", + "Contents": "内容", + "CoverImage": "封面图片", + "CreateBlogPostPage": "新博客帖子", + "CreationTime": "创建时间", "Delete": "删除", - "Reply": "回复", - "Update": "更新", + "Detail": "详情", + "Details": "详情", + "DoYouPreferAdditionalEmails": "你是否更喜欢额外的邮件?", "Edit": "修改", + "EndDate": "结束时间", + "EntityId": "实体Id", + "EntityType": "实体类型", + "ExportCSV": "导出CSV", + "Features": "功能", + "GenericDeletionConfirmationMessage": "你确定删除 '{0}' 吗?", + "LastModification": "最后一次修改", "LoginToAddComment": "登录添加评论", + "LoginToRate": "登录进行评分", "LoginToReply": "登录进行回复", + "Menu:CMS": "CMS", + "Message": "消息", "MessageDeletionConfirmationMessage": "这条评论将被完全删除", - "CommentAuthorizationExceptionMessage": "这些评论不允许公开显示", - "Undo": "撤消", + "Name": "名称", + "New": "新", + "OK": "OK", + "PageDeletionConfirmationMessage": "你确定删除这个页面吗?", + "PageSlugInformation": "Slug用于url. 你的url将是 '/pages/{{slug}}'.", + "Permission:BlogManagement": "博客管理", + "Permission:BlogManagement.Create": "创建", + "Permission:BlogManagement.Delete": "删除", + "Permission:BlogManagement.Features": "删除", + "Permission:BlogManagement.Update": "更新", + "Permission:BlogPostManagement": "博客帖子管理", + "Permission:BlogPostManagement.Create": "创建", + "Permission:BlogPostManagement.Delete": "删除", + "Permission:BlogPostManagement.Update": "更新", + "Permission:CmsKit": "Cms工具包", + "Permission:Comments": "评论管理", + "Permission:Comments.Delete": "删除", + "Permission:Contents": "内容管理", + "Permission:Contents.Create": "创建内容", + "Permission:Contents.Delete": "删除内容", + "Permission:Contents.Update": "更新内容", + "Permission:MediaDescriptorManagement": "媒体管理", + "Permission:MediaDescriptorManagement:Create": "创建", + "Permission:MediaDescriptorManagement:Delete": "删除", + "Permission:PageManagement": "页面管理", + "Permission:PageManagement:Create": "创建", + "Permission:PageManagement:Delete": "删除", + "Permission:PageManagement:Update": "更新", + "Permission:TagManagement": "标签管理", + "Permission:TagManagement.Create": "创建", + "Permission:TagManagement.Delete": "删除", + "Permission:TagManagement.Update": "更新", + "PickYourReaction": "选择你的回应", "RatingUndoMessage": "您的评分将被撤消", - "LoginToRate": "登录进行评分", - "Star": "星" + "Read": "阅读", + "RepliesToThisComment": "回复此评论", + "Reply": "回复", + "ReplyTo": "回复", + "SamplePageMessage": "Pro模块的示例页面", + "SaveChanges": "保存更改", + "SelectAll": "选择所有", + "Send": "发送", + "SendMessage": "发送消息", + "ShortDescription": "简介", + "Slug": "Slug", + "Source": "源", + "SourceUrl": "源URL", + "Star": "星", + "StartDate": "开始时间", + "Subject": "主题", + "SubjectPlaceholder": "请输入主题", + "Submit": "提交", + "Subscribe": "订阅", + "SuccessfullyDeleted": "删除成功!", + "SuccessfullySaved": "保存成功!", + "TagDeletionConfirmationMessage": "你确定删除 '{0}' 标签吗?", + "Tags": "标签", + "Text": "文本", + "ThankYou": "谢谢你", + "Title": "标题", + "Undo": "撤消", + "Update": "更新", + "UpdatePreferenceSuccessMessage": "您的首选项已经保存", + "UpdateYourEmailPreferences": "更新你的邮件首选项", + "UploadFailedMessage": "上传失败", + "UserId": "用户Id", + "Username": "用户名称", + "YourComment": "你的评论", + "YourEmailAddress": "你的邮件地址", + "YourFullName": "你的全称", + "YourMessage": "你的消息", + "YourReply": "你的回复" } } \ No newline at end of file diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/zh-Hans.json b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/zh-Hans.json new file mode 100644 index 0000000000..f835afb592 --- /dev/null +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/LocalizationExtensions/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hans", + "texts": { + "Volo.Abp.Identity:PasswordTooShort": "密码长度必须大于{0}字符. ", + "Volo.Abp.Identity:PasswordRequiresNonAlphanumeric": "密码必须至少包含一个非字母数字字符." + } +} \ No newline at end of file From 4239e035900d68dede5bae789552dd57c66fc178 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 8 Mar 2021 11:25:35 +0300 Subject: [PATCH 092/101] Update en.json --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 51d818aad7..93e1ad4760 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -217,6 +217,7 @@ "FailReason": "Fail reason", "ReIndexAllPosts": "ReIndex All Posts", "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", - "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts" + "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts", + "Permission:FullSearch": "Full search" } } From 41fd2e6fa745ce98316683679409c8f115724eee Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Mon, 8 Mar 2021 11:30:11 +0300 Subject: [PATCH 093/101] Update en.json --- .../Admin/Localization/Resources/en.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 93e1ad4760..39589e06ca 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -215,9 +215,9 @@ "Gateway": "Gateway", "State": "State", "FailReason": "Fail reason", - "ReIndexAllPosts": "ReIndex All Posts", - "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", - "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts", - "Permission:FullSearch": "Full search" + "ReIndexAllPosts": "Reindex All Posts", + "ReIndexAllPostsConfirmationMessage": "Are you sure you want to reindex all posts?", + "SuccessfullyReIndexAllPosts": "All posts have been successfully reindexed.", + "Permission:FullSearch": "Full text search" } } From c267eb1822b8138e6f4593aa39d1aad3fed12c20 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Mon, 8 Mar 2021 11:32:26 +0300 Subject: [PATCH 094/101] Update en.json --- .../AbpIoLocalization/Community/Localization/Resources/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index 47eb726dcb..82033e5849 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -139,6 +139,6 @@ "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct.", "NoPostsFound": "No posts found!", "SearchInPosts": "Search in posts...", - "MinimumSearchContent": "Minimum search content must be 3 letters!" + "MinimumSearchContent": "You must enter at least 3 characters!" } } From bf3025f5a9b985e2bff0d7b8c05fb970d9408487 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 8 Mar 2021 12:13:34 +0300 Subject: [PATCH 095/101] CmsKit - Add tui-editor-jquery-patch.js to Unified project --- .../wwwroot/libs/tui-editor/tui-editor-jquery-patch.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-jquery-patch.js diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-jquery-patch.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-jquery-patch.js new file mode 100644 index 0000000000..cbf26820de --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/tui-editor/tui-editor-jquery-patch.js @@ -0,0 +1,7 @@ +/* + https://jquery.com/upgrade-guide/3.5/#jquery-htmlprefilter-changes +*/ +var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi; +jQuery.htmlPrefilter = function (html) { + return html.replace(rxhtmlTag, "<$1>"); +}; \ No newline at end of file From 4426fde4c8f8fddc0045ca8daec4c3416a934445 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 8 Mar 2021 12:17:43 +0300 Subject: [PATCH 096/101] CmsKit - Better Handling of Emtty tags field in BlogPost create/update --- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js | 3 ++- .../src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index 378ab3f4da..c5265db2c0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -67,6 +67,7 @@ var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); if (tags.length === 0) { + finishSaving(); return; } @@ -77,7 +78,7 @@ tags: tags }) .then(function (result) { - finishSaving(); + finishSaving(result); }); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js index 84754bd316..3a7203e4cb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/update.js @@ -66,6 +66,7 @@ var tags = $tagsInput.val().split(',').map(x => x.trim()).filter(x => x); if (tags.length === 0) { + finishSaving(); return; } @@ -76,7 +77,7 @@ tags: tags }) .then(function (result) { - finishSaving(); + finishSaving(result); }); } From 3038b598a8664118369267ed0910b881ecba5723 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 8 Mar 2021 12:50:21 +0300 Subject: [PATCH 097/101] Update en.json --- .../Admin/Localization/Resources/en.json | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 545b9d7f38..39589e06ca 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -91,6 +91,7 @@ "UserNotFound": "User not found", "{0}WillBeRemovedFromDevelopers": "{0} Will be removed from developers, do you confirm?", "{0}WillBeRemovedFromOwners": "{0} Will be removed from owners, do you confirm?", + "{0}WillBeRemovedFromMembers": "{0} Will be removed from members, do you confirm?", "Computers": "Computers", "UniqueComputerId": "Unique computer id", "LastSeenDate": "Last seen date", @@ -214,22 +215,9 @@ "Gateway": "Gateway", "State": "State", "FailReason": "Fail reason", - "ReIndexAllPosts": "ReIndex All Posts", - "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", - "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts", - "Menu:CliAnalytics": "Cli Analytics", - "TemplateName": "Template name", - "TemplateVersion": "Template version", - "DatabaseProvider": "Database provider", - "IsTiered": "Is Tiered", - "ProjectName": "Project name", - "Username": "User name", - "Tool": "Tool", - "Command": "Command", - "UiFramework": "Ui framework", - "Options": "Options", - "CliAnalytics": "Cli Analytics", - "Permission:CliAnalyticses": "Cli Analyticses", - "Permission:CliAnalytics": "Cli Analytics" + "ReIndexAllPosts": "Reindex All Posts", + "ReIndexAllPostsConfirmationMessage": "Are you sure you want to reindex all posts?", + "SuccessfullyReIndexAllPosts": "All posts have been successfully reindexed.", + "Permission:FullSearch": "Full text search" } } From ced3473fb52374a71d1c92441b41c0853c22ad6b Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 8 Mar 2021 13:35:52 +0300 Subject: [PATCH 098/101] Add missing localizations --- .../Admin/Localization/Resources/en.json | 18 +++++++++++++++++- .../Admin/Localization/Resources/tr.json | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 39589e06ca..2548ab8176 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -218,6 +218,22 @@ "ReIndexAllPosts": "Reindex All Posts", "ReIndexAllPostsConfirmationMessage": "Are you sure you want to reindex all posts?", "SuccessfullyReIndexAllPosts": "All posts have been successfully reindexed.", - "Permission:FullSearch": "Full text search" + "Permission:FullSearch": "Full text search", + "Menu:CliAnalytics": "Cli Analytics", + "TemplateName": "Template name", + "TemplateVersion": "Template version", + "DatabaseProvider": "Database provider", + "IsTiered": "Is Tiered", + "ProjectName": "Project name", + "Username": "User name", + "Tool": "Tool", + "Command": "Command", + "UiFramework": "Ui framework", + "Options": "Options", + "CliAnalytics": "Cli Analytics", + "Permission:CliAnalyticses": "Cli Analyticses", + "Permission:CliAnalytics": "Cli Analytics", + "Search": "Search", + "ClearFilter": "Clear filter" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json index e9a652cdfd..c193a0b621 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json @@ -174,11 +174,14 @@ "IsTiered": "Katmanlı mı", "ProjectName": "Proje ismi", "Username": "Kullanıcı adı", + "Tool": "Araç", "Command": "Komut", "UiFramework": "Ui çerçevesi", "Options": "Seçenekler", "CliAnalytics": "Cli Analitik", "Permission:CliAnalyticses": "Cli Analitikleri", - "Permission:CliAnalytics": "Cli Analitik" + "Permission:CliAnalytics": "Cli Analitik", + "Search": "Ara", + "ClearFilter": "Filtreyi temizle" } } \ No newline at end of file From 7424286282b9ad4faae92d9aede75ac06bae14f0 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 9 Mar 2021 14:03:02 +0800 Subject: [PATCH 099/101] Add RequestedClaims to AbpClaimsPrincipalOptions --- .../Volo/Abp/Security/AbpSecurityModule.cs | 2 +- .../Claims/AbpClaimsPrincipalFactory.cs | 4 ++-- .../Claims/AbpClaimsPrincipalFactoryOptions.cs | 14 -------------- .../Claims/AbpClaimsPrincipalOptions.cs | 18 ++++++++++++++++++ .../Abp/IdentityServer/AbpClaimsService.cs | 18 +++++++++++------- .../AbpIdentityServerDomainModule.cs | 10 +++++++++- .../AspNetIdentity/AbpProfileService.cs | 4 ++-- 7 files changed, 43 insertions(+), 27 deletions(-) delete mode 100644 framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs create mode 100644 framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs index cf517f0de4..98759bcaa2 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs @@ -61,7 +61,7 @@ namespace Volo.Abp.Security } }); - services.Configure(options => + services.Configure(options => { options.Contributors.AddIfNotContains(contributorTypes); }); diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs index b00b38ea8c..7a3ec769c3 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs @@ -9,11 +9,11 @@ namespace Volo.Abp.Security.Claims public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientDependency { protected IServiceScopeFactory ServiceScopeFactory { get; } - protected AbpClaimsPrincipalFactoryOptions Options { get; } + protected AbpClaimsPrincipalOptions Options { get; } public AbpClaimsPrincipalFactory( IServiceScopeFactory serviceScopeFactory, - IOptions abpClaimOptions) + IOptions abpClaimOptions) { ServiceScopeFactory = serviceScopeFactory; Options = abpClaimOptions.Value; diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs deleted file mode 100644 index 8083a018ee..0000000000 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Collections; - -namespace Volo.Abp.Security.Claims -{ - public class AbpClaimsPrincipalFactoryOptions - { - public ITypeList Contributors { get; } - - public AbpClaimsPrincipalFactoryOptions() - { - Contributors = new TypeList(); - } - } -} diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs new file mode 100644 index 0000000000..6e9b584aaa --- /dev/null +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using Volo.Abp.Collections; + +namespace Volo.Abp.Security.Claims +{ + public class AbpClaimsPrincipalOptions + { + public ITypeList Contributors { get; } + + public List RequestedClaims { get; } + + public AbpClaimsPrincipalOptions() + { + Contributors = new TypeList(); + RequestedClaims = new List(); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs index a032ce6824..50750ff567 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs @@ -4,12 +4,15 @@ using System.Security.Claims; using IdentityModel; using IdentityServer4.Services; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Volo.Abp.Security.Claims; namespace Volo.Abp.IdentityServer { public class AbpClaimsService : DefaultClaimsService { + protected readonly AbpClaimsPrincipalOptions Options; + private static readonly string[] AdditionalOptionalClaimNames = { AbpClaimTypes.TenantId, @@ -20,20 +23,21 @@ namespace Volo.Abp.IdentityServer JwtClaimTypes.FamilyName, }; - public AbpClaimsService(IProfileService profile, ILogger logger) + public AbpClaimsService( + IProfileService profile, + ILogger logger, + IOptions options) : base(profile, logger) { + Options = options.Value; } protected override IEnumerable FilterRequestedClaimTypes(IEnumerable claimTypes) { return base.FilterRequestedClaimTypes(claimTypes) - .Union(new []{ - AbpClaimTypes.TenantId, - AbpClaimTypes.EditionId - }); + .Union(Options.RequestedClaims); } - + protected override IEnumerable GetOptionalClaims(ClaimsPrincipal subject) { return base.GetOptionalClaims(subject) @@ -52,4 +56,4 @@ namespace Volo.Abp.IdentityServer } } } -} \ No newline at end of file +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 328c70cc8a..92fd0501d3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -10,7 +10,6 @@ using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.AspNetIdentity; -using Volo.Abp.IdentityServer.ApiScopes; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.IdentityResources; @@ -19,6 +18,7 @@ using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.Security; +using Volo.Abp.Security.Claims; using Volo.Abp.Validation; using Volo.Abp.Threading; @@ -54,6 +54,14 @@ namespace Volo.Abp.IdentityServer options.EtoMappings.Add(typeof(AbpIdentityServerDomainModule)); }); + Configure(options => + { + options.RequestedClaims.AddRange(new []{ + AbpClaimTypes.TenantId, + AbpClaimTypes.EditionId + }); + }); + AddIdentityServer(context.Services); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs index 3eb14131f1..224abc6c10 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity } [UnitOfWork] - public async override Task GetProfileDataAsync(ProfileDataRequestContext context) + public override async Task GetProfileDataAsync(ProfileDataRequestContext context) { using (CurrentTenant.Change(context.Subject.FindTenantId())) { @@ -33,7 +33,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity } [UnitOfWork] - public async override Task IsActiveAsync(IsActiveContext context) + public override async Task IsActiveAsync(IsActiveContext context) { using (CurrentTenant.Change(context.Subject.FindTenantId())) { From 62a801f545dfac58f25c101b52b98813161c94ff Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 9 Mar 2021 14:31:25 +0800 Subject: [PATCH 100/101] Added AbpClaimsServiceOptions --- .../Volo/Abp/Security/AbpSecurityModule.cs | 2 +- .../Security/Claims/AbpClaimsPrincipalFactory.cs | 8 ++++---- ...ions.cs => AbpClaimsPrincipalFactoryOptions.cs} | 7 ++----- .../Volo/Abp/IdentityServer/AbpClaimsService.cs | 4 ++-- .../Abp/IdentityServer/AbpClaimsServiceOptions.cs | 14 ++++++++++++++ .../AbpIdentityServerDomainModule.cs | 2 +- 6 files changed, 24 insertions(+), 13 deletions(-) rename framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/{AbpClaimsPrincipalOptions.cs => AbpClaimsPrincipalFactoryOptions.cs} (60%) create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsServiceOptions.cs diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs index 98759bcaa2..cf517f0de4 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/AbpSecurityModule.cs @@ -61,7 +61,7 @@ namespace Volo.Abp.Security } }); - services.Configure(options => + services.Configure(options => { options.Contributors.AddIfNotContains(contributorTypes); }); diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs index 7a3ec769c3..6ae077580c 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs @@ -9,14 +9,14 @@ namespace Volo.Abp.Security.Claims public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientDependency { protected IServiceScopeFactory ServiceScopeFactory { get; } - protected AbpClaimsPrincipalOptions Options { get; } + protected AbpClaimsPrincipalFactoryOptions FactoryOptions { get; } public AbpClaimsPrincipalFactory( IServiceScopeFactory serviceScopeFactory, - IOptions abpClaimOptions) + IOptions abpClaimOptions) { ServiceScopeFactory = serviceScopeFactory; - Options = abpClaimOptions.Value; + FactoryOptions = abpClaimOptions.Value; } public virtual async Task CreateAsync() @@ -27,7 +27,7 @@ namespace Volo.Abp.Security.Claims var context = new AbpClaimsPrincipalContributorContext(claimsPrincipal, scope.ServiceProvider); - foreach (var contributorType in Options.Contributors) + foreach (var contributorType in FactoryOptions.Contributors) { var contributor = (IAbpClaimsPrincipalContributor) scope.ServiceProvider.GetRequiredService(contributorType); await contributor.ContributeAsync(context); diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs similarity index 60% rename from framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs rename to framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs index 6e9b584aaa..febe0c5661 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalOptions.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs @@ -3,16 +3,13 @@ using Volo.Abp.Collections; namespace Volo.Abp.Security.Claims { - public class AbpClaimsPrincipalOptions + public class AbpClaimsPrincipalFactoryOptions { public ITypeList Contributors { get; } - public List RequestedClaims { get; } - - public AbpClaimsPrincipalOptions() + public AbpClaimsPrincipalFactoryOptions() { Contributors = new TypeList(); - RequestedClaims = new List(); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs index 50750ff567..80c275252c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsService.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.IdentityServer { public class AbpClaimsService : DefaultClaimsService { - protected readonly AbpClaimsPrincipalOptions Options; + protected readonly AbpClaimsServiceOptions Options; private static readonly string[] AdditionalOptionalClaimNames = { @@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer public AbpClaimsService( IProfileService profile, ILogger logger, - IOptions options) + IOptions options) : base(profile, logger) { Options = options.Value; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsServiceOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsServiceOptions.cs new file mode 100644 index 0000000000..a940cb6119 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpClaimsServiceOptions.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace Volo.Abp.IdentityServer +{ + public class AbpClaimsServiceOptions + { + public List RequestedClaims { get; } + + public AbpClaimsServiceOptions() + { + RequestedClaims = new List(); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 92fd0501d3..55121aec99 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.IdentityServer options.EtoMappings.Add(typeof(AbpIdentityServerDomainModule)); }); - Configure(options => + Configure(options => { options.RequestedClaims.AddRange(new []{ AbpClaimTypes.TenantId, From 067731ec2dc56608d22e348529a110eda2c522c6 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 9 Mar 2021 14:36:37 +0800 Subject: [PATCH 101/101] Improved --- .../Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs | 6 +++--- .../Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs index 6ae077580c..b00b38ea8c 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactory.cs @@ -9,14 +9,14 @@ namespace Volo.Abp.Security.Claims public class AbpClaimsPrincipalFactory : IAbpClaimsPrincipalFactory, ITransientDependency { protected IServiceScopeFactory ServiceScopeFactory { get; } - protected AbpClaimsPrincipalFactoryOptions FactoryOptions { get; } + protected AbpClaimsPrincipalFactoryOptions Options { get; } public AbpClaimsPrincipalFactory( IServiceScopeFactory serviceScopeFactory, IOptions abpClaimOptions) { ServiceScopeFactory = serviceScopeFactory; - FactoryOptions = abpClaimOptions.Value; + Options = abpClaimOptions.Value; } public virtual async Task CreateAsync() @@ -27,7 +27,7 @@ namespace Volo.Abp.Security.Claims var context = new AbpClaimsPrincipalContributorContext(claimsPrincipal, scope.ServiceProvider); - foreach (var contributorType in FactoryOptions.Contributors) + foreach (var contributorType in Options.Contributors) { var contributor = (IAbpClaimsPrincipalContributor) scope.ServiceProvider.GetRequiredService(contributorType); await contributor.ContributeAsync(context); diff --git a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs index febe0c5661..8083a018ee 100644 --- a/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs +++ b/framework/src/Volo.Abp.Security/Volo/Abp/Security/Claims/AbpClaimsPrincipalFactoryOptions.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Volo.Abp.Collections; +using Volo.Abp.Collections; namespace Volo.Abp.Security.Claims {