From 0393730eb83f2d2703a8001ac07a1a69c40370ca Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 22 Dec 2020 14:15:13 +0300 Subject: [PATCH 01/53] Add Asp.Net Core environments to .gitignore --- modules/cms-kit/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/cms-kit/.gitignore b/modules/cms-kit/.gitignore index e9589dd2d6..aee8bda8bf 100644 --- a/modules/cms-kit/.gitignore +++ b/modules/cms-kit/.gitignore @@ -251,6 +251,9 @@ paket-files/ .idea/ *.sln.iml +# Asp.NET Core Environments +appsettings.*.json + # CmsKit host/Volo.CmsKit.IdentityServer/Logs/logs.txt host/Volo.CmsKit.HttpApi.Host/Logs/logs.txt From 2ef3635ac57694841e10025475639b78cb4bd83f Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 22 Dec 2020 14:28:31 +0300 Subject: [PATCH 02/53] Draft Content for CmsKit --- .../Volo/CmsKit/Contents/IContentRenderer.cs | 14 ++++++++++++++ .../Contents/IContentRendererProvider.cs | 15 +++++++++++++++ .../Volo/CmsKit/Contents/PlainTextRenderer.cs | 19 +++++++++++++++++++ .../Volo/CmsKit/Contents/IContent.cs | 7 +++++++ .../Volo/CmsKit/Contents/IEntityContent.cs | 8 ++++++++ .../Volo/CmsKit/Contents/Content.cs | 17 +++++++++++++++++ 6 files changed, 80 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs new file mode 100644 index 0000000000..79efa468d7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents +{ + public interface IContentRenderer + { + Task RenderAsync(string content); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs new file mode 100644 index 0000000000..5a1f2077e7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents +{ + public interface IContentRendererProvider + { + Task GetContentRendererAsync(IEntityContent content); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs new file mode 100644 index 0000000000..4745954037 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; +using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Common.Application.Volo.CmsKit.Contents +{ + public class PlainTextRenderer : IContentRenderer, ITransientDependency + { + public Task RenderAsync(IContent content) + { + return Task.FromResult(content?.Value); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs new file mode 100644 index 0000000000..e3fce8c01f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs @@ -0,0 +1,7 @@ +namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents +{ + public interface IContent + { + string Value { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs new file mode 100644 index 0000000000..31f5a3299b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs @@ -0,0 +1,8 @@ +namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents +{ + public interface IEntityContent : IContent + { + string EntityType { get; set; } + string EntityId { get; set; } + } +} 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 new file mode 100644 index 0000000000..48ed1bfc34 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Domain.Volo.CmsKit.Contents +{ + public class Content : FullAuditedAggregateRoot + { + public string Value { get; set; } + public string EntityType { get; set; } + public string EntityId { get; set; } + } +} From 0c54b19085041f93ecf77a0d879a9693776c5aaa Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 22 Dec 2020 14:59:53 +0300 Subject: [PATCH 03/53] refactor content entity and added content renderer --- .../Volo/CmsKit/Contents/IContentRenderer.cs | 14 ----------- .../Contents/IContentRendererProvider.cs | 15 ------------ .../Volo/CmsKit/Contents/PlainTextRenderer.cs | 19 --------------- .../Contents/IContentRenderer.cs | 9 +++++++ .../Contents/PlainTextContentRenderer.cs | 13 ++++++++++ .../Volo/CmsKit/Contents/ContentConsts.cs | 15 ++++++++++++ .../Volo/CmsKit/Contents/IContent.cs | 7 ------ .../Volo/CmsKit/Contents/IEntityContent.cs | 8 ------- .../Volo/CmsKit/Contents/Content.cs | 24 +++++++++++++------ .../CmsKit/Contents/IContentRepository.cs | 10 ++++++++ .../Contents/EfCoreContentRepository.cs | 14 +++++++++++ .../Contents/MongoContentRepository.cs | 14 +++++++++++ 12 files changed, 92 insertions(+), 70 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs deleted file mode 100644 index 79efa468d7..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRenderer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents -{ - public interface IContentRenderer - { - Task RenderAsync(string content); - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs deleted file mode 100644 index 5a1f2077e7..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentRendererProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents -{ - public interface IContentRendererProvider - { - Task GetContentRendererAsync(IEntityContent content); - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs deleted file mode 100644 index 4745954037..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/PlainTextRenderer.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; -using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; - -namespace Volo.CmsKit.Common.Application.Volo.CmsKit.Contents -{ - public class PlainTextRenderer : IContentRenderer, ITransientDependency - { - public Task RenderAsync(IContent content) - { - return Task.FromResult(content?.Value); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs new file mode 100644 index 0000000000..af600d0382 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/IContentRenderer.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace Volo.CmsKit.Web.Contents +{ + public interface IContentRenderer + { + Task RenderAsync(string value); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs new file mode 100644 index 0000000000..3f839947e3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/PlainTextContentRenderer.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.CmsKit.Web.Contents +{ + public class PlainTextContentRenderer : IContentRenderer, ITransientDependency + { + public Task RenderAsync(string value) + { + return Task.FromResult(value); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs new file mode 100644 index 0000000000..758a29e81f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/ContentConsts.cs @@ -0,0 +1,15 @@ +using System; +using Volo.CmsKit.Entities; + +namespace Volo.CmsKit.Contents +{ + public static class ContentConsts + { + public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; + + public static int MaxEntityIdLength { get; set; } = CmsEntityConsts.MaxEntityIdLength; + + // TODO: consider + public static int MaxValueLength = int.MaxValue; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs deleted file mode 100644 index e3fce8c01f..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IContent.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents -{ - public interface IContent - { - string Value { get; set; } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs deleted file mode 100644 index 31f5a3299b..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Contents/IEntityContent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents -{ - public interface IEntityContent : IContent - { - string EntityType { get; set; } - string EntityId { get; set; } - } -} 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 index 48ed1bfc34..34546f6111 100644 --- 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 @@ -1,17 +1,27 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using JetBrains.Annotations; +using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; -using Volo.CmsKit.Domain.Shared.Volo.CmsKit.Contents; -namespace Volo.CmsKit.Domain.Volo.CmsKit.Contents +namespace Volo.CmsKit.Contents { public class Content : FullAuditedAggregateRoot { - public string Value { get; set; } public string EntityType { get; set; } + public string EntityId { get; set; } + + public string Value { get; set; } + + protected Content() + { + + } + public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value) : base(id) + { + EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); + EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); + Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength); + } } } 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 new file mode 100644 index 0000000000..994d2bd4ab --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/IContentRepository.cs @@ -0,0 +1,10 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace Volo.CmsKit.Contents +{ + public interface IContentRepository : IBasicRepository + { + + } +} \ 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 new file mode 100644 index 0000000000..592fccb883 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Contents/EfCoreContentRepository.cs @@ -0,0 +1,14 @@ +using System; +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) + { + } + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..e29b53d417 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Contents/MongoContentRepository.cs @@ -0,0 +1,14 @@ +using System; +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) + { + } + } +} \ No newline at end of file From ed34a5faa13642c3ed84a0cd050ae72107765a75 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Tue, 22 Dec 2020 15:43:08 +0300 Subject: [PATCH 04/53] Revert "Add Asp.Net Core environments to .gitignore" This reverts commit 0393730eb83f2d2703a8001ac07a1a69c40370ca. --- modules/cms-kit/.gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/cms-kit/.gitignore b/modules/cms-kit/.gitignore index aee8bda8bf..e9589dd2d6 100644 --- a/modules/cms-kit/.gitignore +++ b/modules/cms-kit/.gitignore @@ -251,9 +251,6 @@ paket-files/ .idea/ *.sln.iml -# Asp.NET Core Environments -appsettings.*.json - # CmsKit host/Volo.CmsKit.IdentityServer/Logs/logs.txt host/Volo.CmsKit.HttpApi.Host/Logs/logs.txt From cfaef4c05e5d624e0fa8326e2a39bc53e6b5cfc2 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Dec 2020 10:28:27 +0300 Subject: [PATCH 05/53] Template design of Tags in CmsKit --- .../Volo/CmsKit/Tags/TagConsts.cs | 9 +++++ .../Volo/CmsKit/EntityTags/EntityTag.cs | 35 +++++++++++++++++ .../CmsKit/EntityTags/EntityTagManager.cs | 39 +++++++++++++++++++ .../CmsKit/EntityTags/IEntityTagManager.cs | 15 +++++++ .../CmsKit/EntityTags/IEntityTagRepository.cs | 14 +++++++ .../Volo/CmsKit/Tags/ITagRepository.cs | 14 +++++++ .../Volo/CmsKit/Tags/Tag.cs | 31 +++++++++++++++ .../EntityTags/EfCoreEntityTagRepository.cs | 14 +++++++ .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 14 +++++++ .../EntityTags/MongoEntityTagRepository.cs | 14 +++++++ .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 15 +++++++ 11 files changed, 214 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs new file mode 100644 index 0000000000..96b6b3f8e1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.CmsKit.Tags +{ + public static class TagConsts + { + public static int MaxNameLength { get; set; } = 32; + + public static int MaxColorHexLength { get; set; } = 6; + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs new file mode 100644 index 0000000000..62bbd2877d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs @@ -0,0 +1,35 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.CmsKit.Tags +{ + public class EntityTag : AggregateRoot + { + protected EntityTag() + { + } + + public EntityTag(string entityType, string entityId, Guid tagId) + { + EntityType = entityType; + EntityId = entityId; + TagId = tagId; + } + + public virtual string EntityType { get; protected set; } + + public virtual string EntityId { get; protected set; } + + public virtual Guid TagId { get; set; } + + public override object[] GetKeys() + { + return new object[] + { + EntityType, + EntityId, + TagId + }; + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs new file mode 100644 index 0000000000..42f2b9e6d7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.EntityTags; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.EntityTags +{ + public class EntityTagManager : IEntityTagManager + { + private readonly ITagRepository tagRepository; + private readonly IEntityTagRepository entityTagRepository; + + public EntityTagManager( + ITagRepository tagRepository, + IEntityTagRepository entityTagRepository) + { + this.tagRepository = tagRepository; + this.entityTagRepository = entityTagRepository; + } + + public Task AddTagToEntityAsync(Guid tagId, string entityType, string entityId) + { + throw new NotImplementedException(); + } + + public Task> GetEntityTagsAsync(string entityType, string entityId) + { + throw new NotImplementedException(); + } + + public Task RemoveTagFromEntityAsync(Guid tagId, string entityType, string entityId) + { + throw new NotImplementedException(); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs new file mode 100644 index 0000000000..296136fb2d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.EntityTags +{ + public interface IEntityTagManager + { + Task AddTagToEntityAsync(Guid tagId, string entityType, string entityId); + Task RemoveTagFromEntityAsync(Guid tagId, string entityType, string entityId); + Task> GetEntityTagsAsync(string entityType, string entityId); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs new file mode 100644 index 0000000000..127b417bc9 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.EntityTags +{ + public interface IEntityTagRepository : IBasicRepository + { + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs new file mode 100644 index 0000000000..9874fc6e71 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Tags +{ + public interface ITagRepository : IBasicRepository + { + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs new file mode 100644 index 0000000000..3ebe06aa58 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -0,0 +1,31 @@ +using JetBrains.Annotations; +using System; +using Volo.Abp; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.CmsKit.Tags +{ + public class Tag : BasicAggregateRoot, IMultiTenant, IHasCreationTime + { + protected Tag() + { + } + + public Tag( + [NotNull] string name, + [CanBeNull] string colorHex, + [NotNull] Guid? tenantId = null) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); + ColorHex = Check.Length(colorHex, nameof(colorHex), TagConsts.MaxColorHexLength); + TenantId = tenantId; + } + + public virtual string Name { get; set; } + public virtual string ColorHex { get; set; } + public Guid? TenantId { get; } + public DateTime CreationTime { get; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs new file mode 100644 index 0000000000..31663f8d31 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.EntityTags +{ + public class EfCoreEntityTagRepository : EfCoreRepository, IEntityTagRepository + { + public EfCoreEntityTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs new file mode 100644 index 0000000000..0021281fa5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Tags +{ + public class EfCoreTagRepository : EfCoreRepository, ITagRepository + { + public EfCoreTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs new file mode 100644 index 0000000000..23723a86df --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; +using Volo.CmsKit.EntityTags; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.MongoDB.EntityTags +{ + public class MongoEntityTagRepository : MongoDbRepository, IEntityTagRepository + { + public MongoEntityTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs new file mode 100644 index 0000000000..6eaa507ee4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -0,0 +1,15 @@ +using System; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; +using Volo.CmsKit.MongoDB; +using Volo.CmsKit.Tags; + +namespace CmsKit.MongoDB.Tags +{ + public class MongoTagRepository : MongoDbRepository, ITagRepository + { + public MongoTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} From a4fab14dd636c262fa6b9bb066fbe721cea2ff1f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 23 Dec 2020 13:35:21 +0300 Subject: [PATCH 06/53] refactoring tag and adding mongodb configurations for content --- .../Volo/CmsKit/Contents/Content.cs | 17 ++++++++++++----- .../Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs | 18 +++++++++--------- .../CmsKit/MongoDB/CmsKitMongoDbContext.cs | 3 +++ .../MongoDB/CmsKitMongoDbContextExtensions.cs | 6 ++++++ .../Volo/CmsKit/MongoDB/CmsKitMongoDbModule.cs | 3 +++ .../CmsKit/MongoDB/ICmsKitMongoDbContext.cs | 3 +++ 6 files changed, 36 insertions(+), 14 deletions(-) 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 index 34546f6111..229ad037b0 100644 --- 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 @@ -2,26 +2,33 @@ using JetBrains.Annotations; using Volo.Abp; using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; namespace Volo.CmsKit.Contents { - public class Content : FullAuditedAggregateRoot + public class Content : FullAuditedAggregateRoot, IMultiTenant { - public string EntityType { get; set; } + public virtual Guid? TenantId { get; } - public string EntityId { get; set; } + public virtual string EntityType { get; set; } - public string Value { get; set; } + public virtual string EntityId { get; set; } + + public virtual string Value { get; set; } protected Content() { } - public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value) : base(id) + + public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value, Guid? tenantId = null) : base(id) { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength); + + TenantId = tenantId; } + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index 3ebe06aa58..5f6ac203c0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -9,23 +9,23 @@ namespace Volo.CmsKit.Tags { public class Tag : BasicAggregateRoot, IMultiTenant, IHasCreationTime { + public string Name { get; set; } + + public string ColorHex { get; set; } + + public Guid? TenantId { get; } + + public DateTime CreationTime { get; } + protected Tag() { } - public Tag( - [NotNull] string name, - [CanBeNull] string colorHex, - [NotNull] Guid? tenantId = null) + public Tag([NotNull] string name, [CanBeNull] string colorHex, Guid? tenantId = null) { Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); ColorHex = Check.Length(colorHex, nameof(colorHex), TagConsts.MaxColorHexLength); TenantId = tenantId; } - - public virtual string Name { get; set; } - public virtual string ColorHex { get; set; } - public Guid? TenantId { get; } - public DateTime CreationTime { 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 09053167f9..dfd6a4e9a7 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 @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; @@ -19,6 +20,8 @@ namespace Volo.CmsKit.MongoDB public IMongoCollection Ratings => Collection(); + public IMongoCollection Contents => Collection(); + protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); 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 2dc4c55a71..c996dd9017 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 @@ -2,6 +2,7 @@ using Volo.Abp; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; @@ -41,6 +42,11 @@ namespace Volo.CmsKit.MongoDB { x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Ratings"; }); + + builder.Entity(x => + { + x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Contents"; + }); } } } 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 d479821b38..d6b7ce62e1 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 @@ -3,7 +3,9 @@ using Volo.Abp.Modularity; using Volo.Abp.MongoDB; using Volo.Abp.Users.MongoDB; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.MongoDB.Comments; +using Volo.CmsKit.MongoDB.Contents; using Volo.CmsKit.MongoDB.Ratings; using Volo.CmsKit.MongoDB.Reactions; using Volo.CmsKit.MongoDB.Users; @@ -28,6 +30,7 @@ namespace Volo.CmsKit.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } 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 40914a9720..d86c4ababf 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 @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; @@ -18,5 +19,7 @@ namespace Volo.CmsKit.MongoDB IMongoCollection CmsUsers { get; } IMongoCollection Ratings { get; } + + IMongoCollection Contents { get; } } } From c7ccf32a79cd1cdfe3390b63d762f05a81b5a70d Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 23 Dec 2020 14:39:48 +0300 Subject: [PATCH 07/53] added content ef core configurations --- .../CmsKitDbContextModelCreatingExtensions.cs | 14 ++++++++++++++ .../CmsKitEntityFrameworkCoreModule.cs | 2 ++ 2 files changed, 16 insertions(+) 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 b81704034a..ed3f8df710 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,6 +8,7 @@ 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.Ratings; @@ -93,6 +94,19 @@ namespace Volo.CmsKit.EntityFrameworkCore r.HasIndex(x => new {x.TenantId, x.EntityType, x.EntityId, x.CreatorId}); }); } + + 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 }); + }); } } } 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 33e57cab37..52ec478882 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 @@ -3,6 +3,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.Users.EntityFrameworkCore; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; @@ -24,6 +25,7 @@ namespace Volo.CmsKit.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } From 322577ef6fc4dfe29f01db138daf04b9983d196f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Wed, 23 Dec 2020 14:49:29 +0300 Subject: [PATCH 08/53] added tag and entity tag with repositories --- .../Volo/CmsKit/Tags/TagConsts.cs | 6 ++- .../Volo/CmsKit/EntityTags/EntityTag.cs | 35 ----------------- .../CmsKit/EntityTags/EntityTagManager.cs | 39 ------------------- .../CmsKit/EntityTags/IEntityTagManager.cs | 15 ------- .../CmsKit/EntityTags/IEntityTagRepository.cs | 14 ------- .../Volo/CmsKit/Tags/EntityTag.cs | 32 +++++++++++++++ .../Volo/CmsKit/Tags/IEntityTagRepository.cs | 9 +++++ .../Volo/CmsKit/Tags/ITagRepository.cs | 5 --- .../Volo/CmsKit/Tags/Tag.cs | 12 +++--- .../CmsKitDbContextModelCreatingExtensions.cs | 26 +++++++++++++ .../CmsKitEntityFrameworkCoreModule.cs | 3 ++ .../EfCoreEntityTagRepository.cs | 7 ++-- .../CmsKit/MongoDB/CmsKitMongoDbContext.cs | 6 +++ .../MongoDB/CmsKitMongoDbContextExtensions.cs | 11 ++++++ .../CmsKit/MongoDB/CmsKitMongoDbModule.cs | 4 ++ .../CmsKit/MongoDB/ICmsKitMongoDbContext.cs | 6 +++ .../MongoEntityTagRepository.cs | 7 ++-- .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 3 +- 18 files changed, 115 insertions(+), 125 deletions(-) delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs rename modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/{EntityTags => Tags}/EfCoreEntityTagRepository.cs (62%) rename modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/{EntityTags => Tags}/MongoEntityTagRepository.cs (57%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs index 96b6b3f8e1..5affee9c15 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs @@ -1,7 +1,11 @@ -namespace Volo.CmsKit.Tags +using Volo.CmsKit.Entities; + +namespace Volo.CmsKit.Tags { public static class TagConsts { + public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; + public static int MaxNameLength { get; set; } = 32; public static int MaxColorHexLength { get; set; } = 6; diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs deleted file mode 100644 index 62bbd2877d..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTag.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Volo.Abp.Domain.Entities; - -namespace Volo.CmsKit.Tags -{ - public class EntityTag : AggregateRoot - { - protected EntityTag() - { - } - - public EntityTag(string entityType, string entityId, Guid tagId) - { - EntityType = entityType; - EntityId = entityId; - TagId = tagId; - } - - public virtual string EntityType { get; protected set; } - - public virtual string EntityId { get; protected set; } - - public virtual Guid TagId { get; set; } - - public override object[] GetKeys() - { - return new object[] - { - EntityType, - EntityId, - TagId - }; - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs deleted file mode 100644 index 42f2b9e6d7..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/EntityTagManager.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.CmsKit.EntityTags; -using Volo.CmsKit.Tags; - -namespace Volo.CmsKit.EntityTags -{ - public class EntityTagManager : IEntityTagManager - { - private readonly ITagRepository tagRepository; - private readonly IEntityTagRepository entityTagRepository; - - public EntityTagManager( - ITagRepository tagRepository, - IEntityTagRepository entityTagRepository) - { - this.tagRepository = tagRepository; - this.entityTagRepository = entityTagRepository; - } - - public Task AddTagToEntityAsync(Guid tagId, string entityType, string entityId) - { - throw new NotImplementedException(); - } - - public Task> GetEntityTagsAsync(string entityType, string entityId) - { - throw new NotImplementedException(); - } - - public Task RemoveTagFromEntityAsync(Guid tagId, string entityType, string entityId) - { - throw new NotImplementedException(); - } - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs deleted file mode 100644 index 296136fb2d..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagManager.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Threading.Tasks; -using Volo.CmsKit.Tags; - -namespace Volo.CmsKit.EntityTags -{ - public interface IEntityTagManager - { - Task AddTagToEntityAsync(Guid tagId, string entityType, string entityId); - Task RemoveTagFromEntityAsync(Guid tagId, string entityType, string entityId); - Task> GetEntityTagsAsync(string entityType, string entityId); - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs deleted file mode 100644 index 127b417bc9..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/EntityTags/IEntityTagRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; -using Volo.CmsKit.Tags; - -namespace Volo.CmsKit.EntityTags -{ - public interface IEntityTagRepository : IBasicRepository - { - } -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs new file mode 100644 index 0000000000..5825f32936 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs @@ -0,0 +1,32 @@ +using System; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.CmsKit.Tags +{ + public class EntityTag : Entity, IMultiTenant + { + public virtual Guid TagId { get; set; } + + public virtual Guid EntityId { get; set; } + + public virtual Guid? TenantId { get; } + + protected EntityTag() + { + } + + public EntityTag(Guid tagId, Guid entityId, Guid? tenantId = null) + { + TagId = tagId; + EntityId = entityId; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { TagId, EntityId, TenantId }; + } + + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs new file mode 100644 index 0000000000..6ec0fd4b44 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/IEntityTagRepository.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Domain.Repositories; + +namespace Volo.CmsKit.Tags +{ + public interface IEntityTagRepository : IBasicRepository + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs index 9874fc6e71..2a619887c1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -using Volo.CmsKit.Tags; namespace Volo.CmsKit.Tags { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index 5f6ac203c0..80e267264c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -1,28 +1,28 @@ using JetBrains.Annotations; using System; using Volo.Abp; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.MultiTenancy; namespace Volo.CmsKit.Tags { - public class Tag : BasicAggregateRoot, IMultiTenant, IHasCreationTime + public class Tag : FullAuditedAggregateRoot, IMultiTenant { + public string EntityType { get; set; } + public string Name { get; set; } public string ColorHex { get; set; } public Guid? TenantId { get; } - public DateTime CreationTime { get; } - protected Tag() { } - public Tag([NotNull] string name, [CanBeNull] string colorHex, Guid? tenantId = null) + public Tag([NotNull] string entityType, [NotNull] string name, [CanBeNull] string colorHex, Guid? tenantId = null) { + EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength); Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); ColorHex = Check.Length(colorHex, nameof(colorHex), TagConsts.MaxColorHexLength); TenantId = tenantId; 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 ed3f8df710..fe67914dc9 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 @@ -11,6 +11,7 @@ using Volo.Abp.Users.EntityFrameworkCore; using Volo.CmsKit.Contents; using Volo.CmsKit.GlobalFeatures; using Volo.CmsKit.Ratings; +using Volo.CmsKit.Tags; namespace Volo.CmsKit.EntityFrameworkCore { @@ -107,6 +108,31 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityType, x.EntityId }); }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Tags", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); + b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); + b.Property(x => x.ColorHex).IsRequired().HasMaxLength(TagConsts.MaxColorHexLength); + + b.HasIndex(x => new { x.TenantId, x.Name }); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "EntityTags", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.EntityId).IsRequired(); + b.Property(x => x.TagId).IsRequired(); + + b.HasIndex(x => new { x.TenantId, x.EntityId, x.TagId }); + }); } } } 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 52ec478882..7e2057c6f0 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 @@ -6,6 +6,7 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; namespace Volo.CmsKit.EntityFrameworkCore @@ -26,6 +27,8 @@ namespace Volo.CmsKit.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs similarity index 62% rename from modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs rename to modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs index 31663f8d31..cca61b802b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/EntityTags/EfCoreEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs @@ -1,14 +1,13 @@ using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; -using Volo.CmsKit.Tags; -namespace Volo.CmsKit.EntityTags +namespace Volo.CmsKit.Tags { - public class EfCoreEntityTagRepository : EfCoreRepository, IEntityTagRepository + public class EfCoreEntityTagRepository: EfCoreRepository, IEntityTagRepository { public EfCoreEntityTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } } -} +} \ No newline at end of file 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 dfd6a4e9a7..965cf917ec 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 @@ -5,7 +5,9 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; +using Tag = MongoDB.Driver.Tag; namespace Volo.CmsKit.MongoDB { @@ -21,6 +23,10 @@ namespace Volo.CmsKit.MongoDB public IMongoCollection Ratings => Collection(); public IMongoCollection Contents => Collection(); + + public IMongoCollection Tags => Collection(); + + public IMongoCollection EntityTags => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { 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 c996dd9017..f208e5644c 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 @@ -5,6 +5,7 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; namespace Volo.CmsKit.MongoDB @@ -47,6 +48,16 @@ namespace Volo.CmsKit.MongoDB { x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Contents"; }); + + builder.Entity(x => + { + x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Tags"; + }); + + builder.Entity(x => + { + x.CollectionName = CmsKitDbProperties.DbTablePrefix + "EntityTags"; + }); } } } 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 d6b7ce62e1..d86e727a09 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 @@ -8,9 +8,11 @@ using Volo.CmsKit.MongoDB.Comments; using Volo.CmsKit.MongoDB.Contents; using Volo.CmsKit.MongoDB.Ratings; using Volo.CmsKit.MongoDB.Reactions; +using Volo.CmsKit.MongoDB.Tags; using Volo.CmsKit.MongoDB.Users; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; namespace Volo.CmsKit.MongoDB @@ -31,6 +33,8 @@ namespace Volo.CmsKit.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); + options.AddRepository(); }); } } 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 d86c4ababf..5d16305567 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 @@ -5,7 +5,9 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; +using Tag = MongoDB.Driver.Tag; namespace Volo.CmsKit.MongoDB { @@ -21,5 +23,9 @@ 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.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs similarity index 57% rename from modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs rename to modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs index 23723a86df..5ac1a4b69c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/EntityTags/MongoEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs @@ -1,14 +1,13 @@ using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; -using Volo.CmsKit.EntityTags; using Volo.CmsKit.Tags; -namespace Volo.CmsKit.MongoDB.EntityTags +namespace Volo.CmsKit.MongoDB.Tags { - public class MongoEntityTagRepository : MongoDbRepository, IEntityTagRepository + public class MongoEntityTagRepository: MongoDbRepository, IEntityTagRepository { public MongoEntityTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { } } -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 6eaa507ee4..64118c78c9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -1,10 +1,9 @@ using System; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; -using Volo.CmsKit.MongoDB; using Volo.CmsKit.Tags; -namespace CmsKit.MongoDB.Tags +namespace Volo.CmsKit.MongoDB.Tags { public class MongoTagRepository : MongoDbRepository, ITagRepository { From 15c48109028fb8536f41e82b6cc91f345ae44410 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Dec 2020 15:57:42 +0300 Subject: [PATCH 09/53] Add domain & repositories of Tags --- .../Volo/CmsKit/Contents/Content.cs | 1 - .../Volo/CmsKit/Tags/ITagManager.cs | 32 ++++++++ .../Volo/CmsKit/Tags/ITagRepository.cs | 22 ++++- .../Volo/CmsKit/Tags/Tag.cs | 32 +++++--- .../Volo/CmsKit/Tags/TagManager.cs | 80 +++++++++++++++++++ .../CmsKitDbContextModelCreatingExtensions.cs | 2 +- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 46 ++++++++++- .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 46 ++++++++++- 8 files changed, 247 insertions(+), 14 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs 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 index 229ad037b0..2c3cd28593 100644 --- 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 @@ -29,6 +29,5 @@ namespace Volo.CmsKit.Contents TenantId = tenantId; } - } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs new file mode 100644 index 0000000000..25fccfb474 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs @@ -0,0 +1,32 @@ +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Domain.Volo.CmsKit.Tags +{ + public interface ITagManager : IDomainService + { + Task InsertAsync( + [NotNull] string entityType, + [NotNull] string name, + [CanBeNull] string hexColor, + Guid? tenantId = null, + CancellationToken cancellationToken = default); + + Task UpdateAsync( + Guid id, + [NotNull] string name, + [CanBeNull] string hexColor, + CancellationToken cancellationToken = default); + + Task GetOrAddAsync( + [NotNull] string entityType, + [NotNull] string name, + [CanBeNull] string hexColor = null, + Guid? tenantId = null, + CancellationToken cancellationToken = default); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs index 2a619887c1..8cfeee9551 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -1,9 +1,29 @@ -using System; +using JetBrains.Annotations; +using System; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; namespace Volo.CmsKit.Tags { public interface ITagRepository : IBasicRepository { + Task GetAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default); + + Task AnyAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId = null, + CancellationToken cancellationToken = default); + + Task FindAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index 80e267264c..a13ea70ba0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -9,23 +9,37 @@ namespace Volo.CmsKit.Tags public class Tag : FullAuditedAggregateRoot, IMultiTenant { public string EntityType { get; set; } - - public string Name { get; set; } - - public string ColorHex { get; set; } - + + public string Name { get; protected set; } + + public string HexColor { get; protected set; } + public Guid? TenantId { get; } - + protected Tag() { } - public Tag([NotNull] string entityType, [NotNull] string name, [CanBeNull] string colorHex, Guid? tenantId = null) + public Tag( + [NotNull] string entityType, + [NotNull] string name, + [CanBeNull] string hexColor, + Guid? tenantId = null) { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength); - Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); - ColorHex = Check.Length(colorHex, nameof(colorHex), TagConsts.MaxColorHexLength); + SetName(name); + SetHexColor(hexColor); TenantId = tenantId; } + + public void SetName(string name) + { + Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); + } + + public void SetHexColor(string hexColor) + { + HexColor = Check.Length(hexColor, nameof(hexColor), TagConsts.MaxColorHexLength); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs new file mode 100644 index 0000000000..0abdbeb969 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -0,0 +1,80 @@ +using JetBrains.Annotations; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Services; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Domain.Volo.CmsKit.Tags +{ + public class TagManager : DomainService, ITagManager + { + private readonly ITagRepository _tagRepository; + + public TagManager(ITagRepository tagRepository) + { + _tagRepository = tagRepository; + } + + public async Task GetOrAddAsync( + [NotNull] string entityType, + [NotNull] string name, + [CanBeNull] string hexColor = null, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + var entity = await _tagRepository.FindAsync(entityType, name, tenantId, cancellationToken); + + if (entity == null) + { + entity = await InsertAsync(entityType, name, hexColor, tenantId, cancellationToken); + } + + return entity; + } + + public async Task InsertAsync( + [NotNull] string entityType, + [NotNull] string name, + [CanBeNull] string hexColor, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + if (await _tagRepository.AnyAsync(entityType, name, tenantId, cancellationToken)) + { + throw new BusinessException(message: "Tag already exist!"); // Already Exist + } + + return await _tagRepository.InsertAsync( + new Tag( + entityType, + name, + hexColor, + tenantId), + cancellationToken: cancellationToken); + } + + public async Task UpdateAsync( + Guid id, + [NotNull] string name, + [CanBeNull] string hexColor, + CancellationToken cancellationToken = default) + { + var entity = await _tagRepository.GetAsync(id, cancellationToken: cancellationToken); + + entity.SetName(name); + entity.SetHexColor(hexColor); + + if (await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken)) + { + throw new BusinessException(message: "Tag already exist!"); // Already Exist + } + + return await _tagRepository.UpdateAsync(entity); + } + } +} 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 fe67914dc9..c9c6bbca44 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 @@ -117,7 +117,7 @@ namespace Volo.CmsKit.EntityFrameworkCore b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); - b.Property(x => x.ColorHex).IsRequired().HasMaxLength(TagConsts.MaxColorHexLength); + b.Property(x => x.HexColor).IsRequired().HasMaxLength(TagConsts.MaxColorHexLength); b.HasIndex(x => new { x.TenantId, x.Name }); }); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 0021281fa5..8a530ba705 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -1,4 +1,9 @@ -using System; +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore; +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; @@ -10,5 +15,44 @@ namespace Volo.CmsKit.Tags public EfCoreTagRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task AnyAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return DbSet.AnyAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken); + } + + public Task GetAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return GetAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } + + public Task FindAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return FindAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 64118c78c9..9d4644e47b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -1,4 +1,8 @@ -using System; +using JetBrains.Annotations; +using MongoDB.Driver.Linq; +using System; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Tags; @@ -10,5 +14,45 @@ namespace Volo.CmsKit.MongoDB.Tags public MongoTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task AnyAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return GetMongoQueryable() + .AnyAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken); + } + + public Task GetAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return GetAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } + + public Task FindAsync( + [NotNull] string entityType, + [NotNull] string name, + Guid? tenantId, + CancellationToken cancellationToken = default) + { + return FindAsync(x => + x.EntityType == entityType && + x.Name == name && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } From 1f586bc9694d460981b5d24a3618a586dfa62fc2 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Dec 2020 17:59:44 +0300 Subject: [PATCH 10/53] Fix namespaces for CmsKit Tags --- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs | 2 +- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs index 25fccfb474..b1562a341d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Services; using Volo.CmsKit.Tags; -namespace Volo.CmsKit.Domain.Volo.CmsKit.Tags +namespace Volo.CmsKit.Tags { public interface ITagManager : IDomainService { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs index 0abdbeb969..c62317cd64 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -1,15 +1,11 @@ using JetBrains.Annotations; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Domain.Services; -using Volo.CmsKit.Tags; -namespace Volo.CmsKit.Domain.Volo.CmsKit.Tags +namespace Volo.CmsKit.Tags { public class TagManager : DomainService, ITagManager { From a407b312e25e73af7d5d8177bd5fa97ec6bd3422 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Dec 2020 18:18:27 +0300 Subject: [PATCH 11/53] Add missing key to EntityTag for CmsKit --- .../CmsKitDbContextModelCreatingExtensions.cs | 2 ++ 1 file changed, 2 insertions(+) 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 c9c6bbca44..f7cdb5b59e 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 @@ -127,6 +127,8 @@ namespace Volo.CmsKit.EntityFrameworkCore b.ToTable(options.TablePrefix + "EntityTags", options.Schema); b.ConfigureByConvention(); + + b.HasKey(x => new { x.TenantId, x.EntityId, x.TagId }); b.Property(x => x.EntityId).IsRequired(); b.Property(x => x.TagId).IsRequired(); From 5d8cea1bfb69b76add0cf6d5e6ad377b8ab910f8 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 11:36:43 +0300 Subject: [PATCH 12/53] Add @abp/cms-kit package --- modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json index edc0ad64ba..cc22f5d84d 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/package.json @@ -3,6 +3,7 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0-rc.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^4.1.0-rc.2", + "@abp/cms-kit": "4.1.0-rc.2" } } \ No newline at end of file From 972ff0749dc696542256a71007e2884509dc3f60 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 11:37:04 +0300 Subject: [PATCH 13/53] Update yarn --- .../host/Volo.CmsKit.Web.Unified/yarn.lock | 258 ++++++++++-------- 1 file changed, 139 insertions(+), 119 deletions(-) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock index a49fcf1e06..c59ef6d24e 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0-rc.1.tgz#77f1021486a26b6aa88052bd1c45db7d978d44c2" - integrity sha512-xQJGWtWDCykDhe68DEvZPo5fGKvYt8dxaU6AlqC/wga2kfsGWGafKxnndPFfkO0wsdPl85nakAyPITaRFXjO8g== - dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0-rc.1" - -"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0-rc.1.tgz#a316483d40274ecb3acb6d050e0328ea7c95eeca" - integrity sha512-L+e+MEwZ/rgB8htWpDEo+dyE7/wJ0Z1geJrl194/Zxz85aequyOZTX0tJ6eyrryK0BSBnk2/1v/7IkZC+qralw== - dependencies: - "@abp/aspnetcore.mvc.ui" "~4.1.0-rc.1" - "@abp/bootstrap" "~4.1.0-rc.1" - "@abp/bootstrap-datepicker" "~4.1.0-rc.1" - "@abp/datatables.net-bs4" "~4.1.0-rc.1" - "@abp/font-awesome" "~4.1.0-rc.1" - "@abp/jquery-form" "~4.1.0-rc.1" - "@abp/jquery-validation-unobtrusive" "~4.1.0-rc.1" - "@abp/lodash" "~4.1.0-rc.1" - "@abp/luxon" "~4.1.0-rc.1" - "@abp/malihu-custom-scrollbar-plugin" "~4.1.0-rc.1" - "@abp/select2" "~4.1.0-rc.1" - "@abp/sweetalert" "~4.1.0-rc.1" - "@abp/timeago" "~4.1.0-rc.1" - "@abp/toastr" "~4.1.0-rc.1" - -"@abp/aspnetcore.mvc.ui@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0-rc.1.tgz#30294bd2ff5284dcc044b6d92b589b3931c06c31" - integrity sha512-X9teoUD6zwfQ7oo723Rvojg1melY2yUPiVrpeaQN/LJSy/x41TLQwFacx6LsLG19F9CyG0+QA7bqziDCQlI7KA== +"@abp/aspnetcore.mvc.ui.theme.basic@^4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-4.1.0-rc.2.tgz#b9462cbe36c41d68e2f44b79a3a2dba2c1b2b54a" + integrity sha512-KW3J6HnN1zZrCmrWmEcXBnGIOeuJDdp1jUECAm4Bdxi++VzfIbGlVvpcvUdT1E213reOUWi4dPhcej12DwrmDw== + dependencies: + "@abp/aspnetcore.mvc.ui.theme.shared" "~4.1.0-rc.2" + +"@abp/aspnetcore.mvc.ui.theme.shared@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-4.1.0-rc.2.tgz#d64cea1e504bcd3a08a1819025d40f3f84f0aadc" + integrity sha512-A/DRLwtJO7YCdqAgSF84wNRKjvGEQvcBocIwRxXCJEe3drxMoSwkAGjXQlxIYWZKdYbYUWDTjil2Mvwf91GUqg== + dependencies: + "@abp/aspnetcore.mvc.ui" "~4.1.0-rc.2" + "@abp/bootstrap" "~4.1.0-rc.2" + "@abp/bootstrap-datepicker" "~4.1.0-rc.2" + "@abp/datatables.net-bs4" "~4.1.0-rc.2" + "@abp/font-awesome" "~4.1.0-rc.2" + "@abp/jquery-form" "~4.1.0-rc.2" + "@abp/jquery-validation-unobtrusive" "~4.1.0-rc.2" + "@abp/lodash" "~4.1.0-rc.2" + "@abp/luxon" "~4.1.0-rc.2" + "@abp/malihu-custom-scrollbar-plugin" "~4.1.0-rc.2" + "@abp/select2" "~4.1.0-rc.2" + "@abp/sweetalert" "~4.1.0-rc.2" + "@abp/timeago" "~4.1.0-rc.2" + "@abp/toastr" "~4.1.0-rc.2" + +"@abp/aspnetcore.mvc.ui@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-4.1.0-rc.2.tgz#54bf30def590e6d25fc35f77253888f3d9f74b9c" + integrity sha512-eOh5IBn4eNAjj2i6tlLRIV/r61Ef7+Z3PNvGgdml/XCo50el4G9XE7shxuGOY+MaFMfmsST2tcJlO9iAo9n2Yw== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -43,145 +43,160 @@ micromatch "^4.0.2" path "^0.12.7" -"@abp/bootstrap-datepicker@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0-rc.1.tgz#fa9bd12f966b6aded9ec798088513a98d1a6f717" - integrity sha512-swXBBvvw4eHgfsbMs6tfbtq+N88f9VoTvgoQE9VqbglZrTfFwHFxq8zuqmG7nQoUd+HfoXnnNBrOn4U6hYpkxA== +"@abp/bootstrap-datepicker@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-4.1.0-rc.2.tgz#d3fe863222a11771d366b1a3c246aaf34df94081" + integrity sha512-vn2xWAK3xqo5fMZJ9dOAZZmL+ZUnzZZNh3lF6uA97wTN/SbePlmHBYJpsCKIxOwbJS2HCvekHGJN/Ps4oEjlbw== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0-rc.1.tgz#aad1713a1edd3eca51569ee64f3d9359a0147d75" - integrity sha512-LF2ma0E65f0GZqRDPQsP5eSTQDc75QUBkwOXnZNpDvvd+ZeUmpUnejc+Zghc0PaQeVZ2/eaqBlilthvdSlW25A== +"@abp/bootstrap@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-4.1.0-rc.2.tgz#b5132cf4c4c92fe833823cf2b91ab1b0167b0ecf" + integrity sha512-SsWEV0DveBIHiG051E6aBB371D15QIsGeo+POFhvQUvrlmzMBlFCAlmH0ef8w1n+3M3C37irCgEGKctt2pbcxQ== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" bootstrap "^4.5.0" bootstrap-v4-rtl "4.4.1-2" -"@abp/core@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0-rc.1.tgz#d607852ace424e8fb96b333f864cda356dd8eacb" - integrity sha512-MedPAclj6iZnZZRs9IAGkQUagrv3/XZJYWHlROKeGvGvsrCBMkKlDVriQ1GhxzS9TQ2FOwtjMEPL5DOw35ESDg== +"@abp/cms-kit@4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/cms-kit/-/cms-kit-4.1.0-rc.2.tgz#d2790dd3812214ab0c8eba6e9ad2b8019889e056" + integrity sha512-bS632Qp3tN+LHVj505lUgwtu2JVOhSf3W6VAXlYG0pSy8n1ltonDZHNKO6iwvnskdPaAA4wgJPWgqjXigChx0Q== dependencies: - "@abp/utils" "^4.1.0-rc.1" + "@abp/star-rating-svg" "~4.1.0-rc.2" -"@abp/datatables.net-bs4@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0-rc.1.tgz#cf11cbf0941ba10ca628c806273a783769c58c7b" - integrity sha512-9sRONOte0lDoyGWBNYkAWKjGDl4IG0Ip4olqLrO4iyPyE22E9DY/6Nvl/X1SIRU4QCGSn13b14VP2JycTXFt+Q== +"@abp/core@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-4.1.0-rc.2.tgz#d306106a53fa56109751be0099785c94f43be56f" + integrity sha512-b0mOYSz8hNgZ/hBeYg8hkthJgE8CLyHNa2NcythPoIW8RR5qHmDtGoFnuFovLvLk7r+M4NWyxXRKEshSszIPyA== dependencies: - "@abp/datatables.net" "~4.1.0-rc.1" + "@abp/utils" "^4.1.0-rc.2" + +"@abp/datatables.net-bs4@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-4.1.0-rc.2.tgz#99aa1fbad91939fc23265324a3d8a45d0c1e5a7a" + integrity sha512-Y9UyqniOkx5DJO+2GGurnQE1yfRmGaQ3y7V07gKWRq+gHLUhE+vfgOLVpGM6ufdTIbLvVw5Ng+3gfOmPlUnpxg== + dependencies: + "@abp/datatables.net" "~4.1.0-rc.2" datatables.net-bs4 "^1.10.21" -"@abp/datatables.net@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0-rc.1.tgz#882e8b00148ccd58f674253aa492b2d197bc0b58" - integrity sha512-HnWBL1i+/fEHh7JUapX20w7nWBBfr44JBvPQy6JSrOD82+BLpPBMDN02uLC8TUR5KJLHTrLecus10qaQ8FUsrA== +"@abp/datatables.net@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-4.1.0-rc.2.tgz#1a134688259d32187d822d8a49c7a68b4cc226c7" + integrity sha512-9o5g8s7ZTlThd1FMFmO7wS+MxmXgUMmiWx7Hwara9ypfJPd0vanz10bQAdTpLiDy/aa0tUmz0xOVj73yvBJm9Q== dependencies: - "@abp/jquery" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" datatables.net "^1.10.21" -"@abp/font-awesome@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0-rc.1.tgz#e17b6b7a209247ce7d4bab6ba1c89060236c100d" - integrity sha512-lHSJaZBea+eIBS25WJmP+Ual5k96vDDEQP3jwaNbqBfZhm3PUcd+JYS2/LCTHyezvtyOt+CmNOSslK3/XlyzFQ== +"@abp/font-awesome@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-4.1.0-rc.2.tgz#ecf490861c09250cf61611ac74cec5ab4392e807" + integrity sha512-6yAsf/ee2hdrHHUACql8c3gY54Hd7YAK2olHymyc3Io2hhK2VxXRc2W2oRSwbQ9GsSE+XDrEVtjIR64nBseTeg== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" "@fortawesome/fontawesome-free" "^5.13.0" -"@abp/jquery-form@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0-rc.1.tgz#d179002c7187232a0c58c57f097c97f2762a0ea7" - integrity sha512-K4tVphzYiZkM/259j1JOqDihXh92ZBwuPZcjEznySxZkk7vuSEEWXb5Utr/+e1+hAgkLS/e9Apv5ZzIv9gyvkg== +"@abp/jquery-form@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-4.1.0-rc.2.tgz#76dff67a3fe6e6ad7bd60bb909de93c09966cc0a" + integrity sha512-LGafwxyRYUbHQlJ9pPbYdkVqzdT/y1Fp4Nr4C3W5jxsJuaSICl0RPkRHIPALeoqbpEWuj6dVep6ZuO9hhxBzNw== dependencies: - "@abp/jquery" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" jquery-form "^4.3.0" -"@abp/jquery-validation-unobtrusive@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0-rc.1.tgz#7192903f39bc75923cfc5d6c2200636347eea9a5" - integrity sha512-S4dInrXybcUcZYjHsanj1fwvf9jSTtOQZnoMVL8wdrWa0OA7zYkKmzmE9Kx3pGzqVbPpvkOLuQT35YgK5jyn5Q== +"@abp/jquery-validation-unobtrusive@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-4.1.0-rc.2.tgz#1f1d395cfa47740d47303ff512592ff1993f9e13" + integrity sha512-0LXWvgfyLHVw7qRVOmY0rfVlq+yJq/nhbcVoYK+QbmKnrFu+KZg0KNMOD8wTXs8mZ1EKGQpoQKWxImtCnGrV/A== dependencies: - "@abp/jquery-validation" "~4.1.0-rc.1" + "@abp/jquery-validation" "~4.1.0-rc.2" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0-rc.1.tgz#43dcc20c5deb82c9b42409c55fc23aca457632b8" - integrity sha512-mHZTCIVkDwhKMJfGRk0k78dfChp3z1k4Sy0dNPAnbIIn9PQL819yh7ug47SkJtllnYQYkj9tAedXIVxG6EdYPA== +"@abp/jquery-validation@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-4.1.0-rc.2.tgz#ad4b464fd0133eab8d08c781c7d7c4e00bc4918d" + integrity sha512-iLTobfwqDk7iiQxvv5UowxOKywsh/77VlAVktstnFG3N3Y73+JYKzM0mGM/j4zM1OrjbF9/cnPnDVX7bATPz9w== dependencies: - "@abp/jquery" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" jquery-validation "^1.19.2" -"@abp/jquery@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0-rc.1.tgz#012cd17d1cab3155a146be5b2d68ed0dd107eb11" - integrity sha512-yMRUsYEiNifbv8iEHKxoCu8F+uyB13Awm0UtU+TU+Z7+9AcS8L2RdRI47XWxSanKi7g9THEYSTE99acw9h3nNQ== +"@abp/jquery@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-4.1.0-rc.2.tgz#0f64cad5b1ae3e47d2344e5fb30c347b89d6d2bb" + integrity sha512-YubZwMJIN+UcfxfUlt3usfcLMG9WcXNpemUsdBtlKNzti562KZMIHPFLRL+DsiqvzZ74h2PxSWWsxS42Z7z0Yw== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" jquery "~3.5.1" -"@abp/lodash@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0-rc.1.tgz#10b54e2a698499bba11a00c690afe7a9a7b61d41" - integrity sha512-MQoWBvj0EMi23s7beBbhioO7mlFk0Xhdes7dgvJLFQRafjpkjZk2YRbHmhvT3BCimYI7SRD3xFTN28Z5I8MlUA== +"@abp/lodash@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-4.1.0-rc.2.tgz#9281c641ab7b7b33e7acf12815dc461e7ae967b9" + integrity sha512-RqdekrAyLPaLNJddmrq89EdrI1xg4296tOafFLHvirgRWisJTIa9bflTOwMwEg9FNdLJgA0zHi4WdAMer0qZdA== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" lodash "^4.17.15" -"@abp/luxon@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0-rc.1.tgz#d4db198d68ce79364665291d22540089957cfc84" - integrity sha512-VTWsmsBj7dTGBzoIG9HU2Z7PpwjWQFRGCwIekvDksaYBVE4tCYS0AMcKsracYha+oY/uOZL1o5ztWgnfHnAmHQ== +"@abp/luxon@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-4.1.0-rc.2.tgz#78fc1cf651d7c19b87a31823cd3ce68961d6b1e6" + integrity sha512-U4e9uGZlg9xj9tBNP337v3wiaSR6qxWsBgh/duQGWrqV+75LlQjYcZaPoXDidUUS6U6epDSR2pc2T39rahcgSQ== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" luxon "^1.24.1" -"@abp/malihu-custom-scrollbar-plugin@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0-rc.1.tgz#13b56b0edcf468845b765eb8e58f663bd4263919" - integrity sha512-7ZJdZz8Hw35XGgQF/i1fEzknZYTzmtITZXB+DuVUISBLH0DKisqIREdYiHeGTFhY5fQqbW8ImY65WacKAImlYw== +"@abp/malihu-custom-scrollbar-plugin@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-4.1.0-rc.2.tgz#36553e71052cad9734e0c9b2c65759e538468648" + integrity sha512-JQ6PCcj5qmF9MxNRPAsKHHnqBPCdn4lQnwxZrHcG9tD70Gx+NfC4UH41tqXI+htba4k0PHRyH2y39Q1iJm0NFA== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0-rc.1.tgz#316e6de20ea0d02000c176ff6522bccaf1fbaa59" - integrity sha512-UZIXmxke8y9PUBjk8mBDyEY2y8jmYhssFt5SVEWEfWOg9NG6fvkOa+JCZl9wS9jtyPAHCMfCJIeLqFpkxiL3Vw== +"@abp/select2@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-4.1.0-rc.2.tgz#c48e865f401ddce32dff2a7a14ae07c4bde2f57b" + integrity sha512-YYK/SIqXQcSDQFMVg/ogohc76d4JDrOVQEbzfkNNI5bKVJo+hkqtNzAwV9FLdPZZNw15QMv0eF1ie4aUtIxyaA== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/core" "~4.1.0-rc.2" select2 "^4.0.13" -"@abp/sweetalert@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0-rc.1.tgz#13c72aa4d93017316908cbbb67f8587eadec79e2" - integrity sha512-0JNLgxAc/iFYdgtn84S6L1tL6mShbMMvFKLpip8fTsLX1PFAf1o4sNOjHCUZ6J1+2rrGgkBc/azMKBVep2ULQA== +"@abp/star-rating-svg@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/star-rating-svg/-/star-rating-svg-4.1.0-rc.2.tgz#558c681eb591847b3e8f114cbe610e4331f8a0a2" + integrity sha512-LNFCfytarGhqS+91lxYHQKMvlbHMDpjU0Knj8qyefNtQ+rbM2CEspWEtcducim+Qn4brqIHRudUvLI+eEC/0yQ== dependencies: - "@abp/core" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" + star-rating-svg "^3.5.0" + +"@abp/sweetalert@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-4.1.0-rc.2.tgz#cdcaf8e9a33cf218a687fd6a42cfe1c85d89c6b7" + integrity sha512-sjQd8TF9oUnaQ1OPTGdVyAfWqSZEk4bRbC/qw2CouEOfRLatzkC0JcmzFLN0f5N1am1RQwkFakpENKH7NqTCvg== + dependencies: + "@abp/core" "~4.1.0-rc.2" sweetalert "^2.1.2" -"@abp/timeago@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0-rc.1.tgz#e72fcdbde3b79bbe2ad8565abb45ba09af527ce0" - integrity sha512-E2kobQoglVD+dNFmuSJgbqbjaON65lNaDeiABesvgDnm308YBDyEvIZ746yqBfJHnMqyBVX8VHOcnY49QJfXkA== +"@abp/timeago@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-4.1.0-rc.2.tgz#445d043ae482b76799b496ae6565abfaf75a34b9" + integrity sha512-wWx56EZMUGIfqJV5JLCvUp4RVhKXHYLQaVNQSF8E05COXmSQwFThVS7vbuiODFp2BGm6RAqCVtZDCreu2B8z9Q== dependencies: - "@abp/jquery" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" timeago "^1.6.7" -"@abp/toastr@~4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0-rc.1.tgz#cff01b9a937e6e38679428724113cc62ea562743" - integrity sha512-HYiYukOA3HjSpFD9ZKMrfU/u/T/mzfpLhtFVz6bG3i5ciSgaOrYFm1pWVG1tA2yg3oelBymYJ9oW29GuPTk30Q== +"@abp/toastr@~4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-4.1.0-rc.2.tgz#1af16fa8687201b6b9c7229d087a4233998703b9" + integrity sha512-g+Jl5H1ZHoJ4JwWuix0xA+GMFY42pwq8WYjxP6qE2/Y2aixYHVIui15eBqF2L06yXOt53YFcC1+pxjrp91xHxw== dependencies: - "@abp/jquery" "~4.1.0-rc.1" + "@abp/jquery" "~4.1.0-rc.2" toastr "^2.1.4" -"@abp/utils@^4.1.0-rc.1": - version "4.1.0-rc.1" - resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0-rc.1.tgz#2863867985db9d178a5ce4347309f060f1ce6142" - integrity sha512-C8e+x5/IdkJWQ8gLtO7ygsth5sd1iXKn0ARu/5u0g11nMjHsMY9Qkwg5QrnpHp2ws1+FL1Dg67omrQp9+KK5SA== +"@abp/utils@^4.1.0-rc.2": + version "4.1.0-rc.2" + resolved "https://registry.yarnpkg.com/@abp/utils/-/utils-4.1.0-rc.2.tgz#eb6dbf0ee493d0f050b37347d2d6d283098aedae" + integrity sha512-V2k5I89lVBoeGIKgg4p2H9GlMAcDWbctwKZPVwBEMVEVm1uTR2xQAWdTdSFd5Q8I8Xsf/aIG8ELM7l5j2h7/zQ== dependencies: just-compare "^1.3.0" @@ -2321,6 +2336,11 @@ stack-trace@0.0.10: resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= +star-rating-svg@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/star-rating-svg/-/star-rating-svg-3.5.0.tgz#72b147015a433da63153fb607af6d51c7c1ea364" + integrity sha1-crFHAVpDPaYxU/tgevbVHHweo2Q= + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" From 02810032e8ff1b6bd3eb0d68f5ce0744534e1372 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 11:37:20 +0300 Subject: [PATCH 14/53] Add migrations for Content & Tags --- ...224075340_Added_ContentAndTags.Designer.cs | 1577 +++++++++++++++++ .../20201224075340_Added_ContentAndTags.cs | 99 ++ .../UnifiedDbContextModelSnapshot.cs | 163 ++ 3 files changed, 1839 insertions(+) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs new file mode 100644 index 0000000000..28f86174e7 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs @@ -0,0 +1,1577 @@ +// +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("20201224075340_Added_ContentAndTags")] + partial class Added_ContentAndTags + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + 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.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.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.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("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("EntityId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("TenantId", "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("HexColor") + .IsRequired() + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + 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.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.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/20201224075340_Added_ContentAndTags.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs new file mode 100644 index 0000000000..572bef4266 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs @@ -0,0 +1,99 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_ContentAndTags : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CmsContents", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsContents", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsEntityTags", + columns: table => new + { + TagId = table.Column(type: "uniqueidentifier", nullable: false), + EntityId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsEntityTags", x => new { x.TenantId, x.EntityId, x.TagId }); + }); + + migrationBuilder.CreateTable( + name: "CmsTags", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + HexColor = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsTags", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CmsContents_TenantId_EntityType_EntityId", + table: "CmsContents", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsEntityTags_TenantId_EntityId_TagId", + table: "CmsEntityTags", + columns: new[] { "TenantId", "EntityId", "TagId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsTags_TenantId_Name", + table: "CmsTags", + columns: new[] { "TenantId", "Name" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CmsContents"); + + migrationBuilder.DropTable( + name: "CmsEntityTags"); + + migrationBuilder.DropTable( + name: "CmsTags"); + } + } +} 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 a082d0db17..78f5a086d4 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 @@ -1096,6 +1096,78 @@ 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.Ratings.Rating", b => { b.Property("Id") @@ -1175,6 +1247,97 @@ namespace Volo.CmsKit.Migrations b.ToTable("CmsUserReactions"); }); + modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("EntityId") + .HasColumnType("uniqueidentifier"); + + b.Property("TagId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("TenantId", "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("HexColor") + .IsRequired() + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + 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") From 5aade06e8bfe98c8a270e2719b57ca819f646ac7 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 12:13:27 +0300 Subject: [PATCH 15/53] Update wwwroot of CmsKit --- .../star-rating-svg/css/star-rating-svg.css | 37 +++++++++++++++++++ .../js/jquery.star-rating-svg.min.js | 1 + 2 files changed, 38 insertions(+) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/css/star-rating-svg.css create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/js/jquery.star-rating-svg.min.js diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/css/star-rating-svg.css b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/css/star-rating-svg.css new file mode 100644 index 0000000000..2c0114687f --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/css/star-rating-svg.css @@ -0,0 +1,37 @@ +.jq-stars { + display: inline-block; +} + +.jq-rating-label { + font-size: 22px; + display: inline-block; + position: relative; + vertical-align: top; + font-family: helvetica, arial, verdana; +} + +.jq-star { + width: 100px; + height: 100px; + display: inline-block; + cursor: pointer; +} + +.jq-star-svg { + width: 100%; + height: 100% ; +} + +.jq-star:hover .fs-star-svg polygon { +} + +.jq-star-svg polygon { + stroke: #000; + stroke-linejoin: round; +} + +/* un-used */ +.jq-shadow { + -webkit-filter: drop-shadow( -2px -2px 2px #888 ); + filter: drop-shadow( -2px -2px 2px #888 ); +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/js/jquery.star-rating-svg.min.js b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/js/jquery.star-rating-svg.min.js new file mode 100644 index 0000000000..df947cfe2b --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/wwwroot/libs/star-rating-svg/js/jquery.star-rating-svg.min.js @@ -0,0 +1 @@ +!function(a){"use strict";var b="starRating",c=function(){},d={totalStars:5,useFullStars:!1,emptyColor:"lightgray",hoverColor:"orange",activeColor:"gold",useGradient:!0,readOnly:!1,disableAfterRate:!0,starGradient:{start:"#FEF7CD",end:"#FF9511"},strokeWidth:0,strokeColor:"black",initialRating:0,starSize:40,callback:c,onHover:c,onLeave:c},e=function(c,e){var f;this.element=c,this.$el=a(c),this.settings=a.extend({},d,e),f=this.$el.data("rating")||this.settings.initialRating,this._state={rating:(Math.round(2*f)/2).toFixed(1)},this._uid=Math.floor(999*Math.random()),e.starGradient||this.settings.useGradient||(this.settings.starGradient.start=this.settings.starGradient.end=this.settings.activeColor),this._defaults=d,this._name=b,this.init()},f={init:function(){this.renderMarkup(),this.addListeners(),this.initRating()},addListeners:function(){this.settings.readOnly||(this.$stars.on("mouseover",this.hoverRating.bind(this)),this.$stars.on("mouseout",this.restoreState.bind(this)),this.$stars.on("click",this.handleRating.bind(this)))},hoverRating:function(a){var b=this.getIndex(a);this.paintStars(b,"hovered"),this.settings.onHover(b+1,this._state.rating,this.$el)},handleRating:function(a){var b=this.getIndex(a),c=b+1;this.applyRating(c,this.$el),this.executeCallback(c,this.$el),this.settings.disableAfterRate&&this.$stars.off()},applyRating:function(a){var b=a-1;this.paintStars(b,"active"),this._state.rating=b+1},restoreState:function(a){var b=this.getIndex(a),c=this._state.rating||-1;this.paintStars(c-1,"active"),this.settings.onLeave(b+1,this._state.rating,this.$el)},getIndex:function(b){var c=a(b.currentTarget),d=c.width(),e=a(b.target).attr("data-side");e=e?e:this.getOffsetByPixel(b,c,d),e=this.settings.useFullStars?"right":e;var f=c.index()-("left"===e?.5:0);return f=.5>f&&b.offsetX=d&&!this.settings.useFullStars?"left":"right"},initRating:function(){this.paintStars(this._state.rating-1,"active")},paintStars:function(b,c){var d,e,f,g;a.each(this.$stars,function(h,i){d=a(i).find('polygon[data-side="left"]'),e=a(i).find('polygon[data-side="right"]'),f=g=b>=h?c:"empty",f=h-b===.5?c:f,d.attr("class","svg-"+f+"-"+this._uid),e.attr("class","svg-"+g+"-"+this._uid)}.bind(this))},renderMarkup:function(){for(var a='
"+this.getLinearGradient(this._uid+"_SVGID_1_",this.settings.emptyColor,this.settings.emptyColor)+this.getLinearGradient(this._uid+"_SVGID_2_",this.settings.hoverColor,this.settings.hoverColor)+this.getLinearGradient(this._uid+"_SVGID_3_",this.settings.starGradient.start,this.settings.starGradient.end)+'
',b="",c=0;c '},executeCallback:function(a,b){var c=this.settings.callback;c(a,b)}},g={unload:function(){var c="plugin_"+b,d=a(this),e=d.data(c).$stars;e.off(),d.removeData(c).remove()},setRating:function(c,d){var e="plugin_"+b,f=a(this),g=f.data(e);c>g.settings.totalStars||0>c||(d&&(c=Math.round(c)),g.applyRating(c))},getRating:function(){var c="plugin_"+b,d=a(this),e=d.data(c);return e._state.rating}};a.extend(e.prototype,f),a.fn[b]=function(c){if(!a.isPlainObject(c)){if(g.hasOwnProperty(c))return g[c].apply(this,Array.prototype.slice.call(arguments,1));a.error("Method "+c+" does not exist on "+b+".js")}return this.each(function(){a.data(this,"plugin_"+b)||a.data(this,"plugin_"+b,new e(this,c))})}}(jQuery,window,document); \ No newline at end of file From fdb55de819abafb33811d325dfe0d61a09394b2e Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 12:16:24 +0300 Subject: [PATCH 16/53] Add ContentViewComponent --- .../Volo/CmsKit/Contents/ContentDto.cs | 10 ++++ .../CmsKit/Contents/IContentAppService.cs | 10 ++++ ...msKitCommonApplicationAutoMapperProfile.cs | 13 +++++ .../CmsKit/CmsKitCommonApplicationModule.cs | 7 +++ .../Volo/CmsKit/Contents/ContentAppService.cs | 25 +++++++++ .../Contents/ContentViewComponent.cs | 55 +++++++++++++++++++ .../Shared/Components/Contents/Default.cshtml | 8 +++ .../CmsKit/Contents/IContentRepository.cs | 11 +++- .../Contents/EfCoreContentRepository.cs | 17 ++++++ .../Contents/MongoContentRepository.cs | 17 ++++++ 10 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/ContentDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/ContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/ContentDto.cs new file mode 100644 index 0000000000..100626fb6d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/ContentDto.cs @@ -0,0 +1,10 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Contents +{ + public class ContentDto : EntityDto + { + public string Value { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs new file mode 100644 index 0000000000..0ac862e787 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Contents +{ + public interface IContentAppService + { + Task GetAsync(string entityType, string entityId); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs new file mode 100644 index 0000000000..b7cb5e2210 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs @@ -0,0 +1,13 @@ +using AutoMapper; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Common.Application.Volo.CmsKit +{ + public class CmsKitCommonApplicationAutoMapperProfile : Profile + { + public CmsKitCommonApplicationAutoMapperProfile() + { + CreateMap(); + } + } +} 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 5300afdcda..8fa08fa950 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 @@ -12,5 +12,12 @@ namespace Volo.CmsKit )] public class CmsKitCommonApplicationModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.AddMaps(validate: true); + }); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs new file mode 100644 index 0000000000..77f2fe39ef --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Volo.CmsKit.Contents +{ + public class ContentAppService : CmsKitAppServiceBase, IContentAppService + { + private readonly IContentRepository _contentRepository; + + public ContentAppService(IContentRepository contentRepository) + { + _contentRepository = contentRepository; + } + + public async Task GetAsync(string entityType, string entityId) + { + var entity = await _contentRepository.FindAsync(entityType, entityId); // Tenant??? + + return ObjectMapper.Map(entity); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs new file mode 100644 index 0000000000..012768b0d7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.CmsKit.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 IContentAppService contentAppService; + + public ContentViewComponent( + IContentRenderer contentRenderer, + IContentAppService contentAppService) + { + this.contentRenderer = contentRenderer; + this.contentAppService = contentAppService; + } + + public virtual async Task InvokeAsync( + string entityType, + string entityId) + { + var content = await contentAppService.GetAsync(entityType, entityId); + var viewModel = new ContentViewModel + { + EntityId = entityId, + EntityType = entityType, + ContentId = content.Id, + Rendered = await contentRenderer.RenderAsync(content.Value) + }; + + return View("~/Pages/CmsKit/Shared/Components/Contents/Default.cshtml", viewModel); + } + + public class ContentViewModel + { + public Guid ContentId { get; set; } + public string EntityType { get; set; } + + public string EntityId { get; set; } + + public string Rendered { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml new file mode 100644 index 0000000000..f5bd0ba344 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml @@ -0,0 +1,8 @@ +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.CmsKit.Localization +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents +@model ContentViewComponent.ContentViewModel + +
+ @Html.Raw(Model.Rendered) +
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 index 994d2bd4ab..2adbab8e5a 100644 --- 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 @@ -1,10 +1,17 @@ -using System; +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 FindAsync( + [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 index 592fccb883..3522eed022 100644 --- 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 @@ -1,4 +1,6 @@ using System; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; @@ -10,5 +12,20 @@ namespace Volo.CmsKit.Contents public EfCoreContentRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task FindAsync( + string entityType, + string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + return FindAsync(x => + !x.IsDeleted && + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken + ); + } } } \ No newline at end of file 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 index e29b53d417..f9a65bb469 100644 --- 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 @@ -1,4 +1,6 @@ using System; +using System.Threading; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Contents; @@ -10,5 +12,20 @@ namespace Volo.CmsKit.MongoDB.Contents public MongoContentRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task FindAsync( + string entityType, + string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + return FindAsync(x => + !x.IsDeleted && + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken + ); + } } } \ No newline at end of file From 5ff01929ee7c9e9e0ef2e8fdf5833fae908e75b8 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 12:17:36 +0300 Subject: [PATCH 17/53] Render static content in a razor page --- .../host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 e61017dd4b..78986a8a99 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 @@ -7,6 +7,7 @@ @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting @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.Contents @model IndexModel @inject IStringLocalizer Localizer

CMS Kit DEMO

@@ -14,10 +15,9 @@ -

- "Any fool can write code that a computer can understand. Good programmers write code that humans can understand." -

-

- Martin Fowler

+ + @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = "quote", entityId = "1" }) +
@@ -71,4 +71,4 @@ @await Component.InvokeAsync(typeof(CommentingViewComponent), new { entityType = "quote", entityId = "2" }) } - + From 5461d4436be0ed2cb11063edfd5207c962829a66 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Thu, 24 Dec 2020 15:41:20 +0300 Subject: [PATCH 18/53] Update ContentAppService.cs --- .../Volo/CmsKit/Contents/ContentAppService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index 77f2fe39ef..89916275bd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -8,16 +8,16 @@ namespace Volo.CmsKit.Contents { public class ContentAppService : CmsKitAppServiceBase, IContentAppService { - private readonly IContentRepository _contentRepository; + protected readonly IContentRepository ContentRepository; public ContentAppService(IContentRepository contentRepository) { - _contentRepository = contentRepository; + ContentRepository = contentRepository; } - public async Task GetAsync(string entityType, string entityId) + public virtual async Task GetAsync(string entityType, string entityId) { - var entity = await _contentRepository.FindAsync(entityType, entityId); // Tenant??? + var entity = await ContentRepository.FindAsync(entityType, entityId); // Tenant??? return ObjectMapper.Map(entity); } From 81a0f166f4aad3367f57079f38d092b47ea0672a Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:03:24 +0300 Subject: [PATCH 19/53] Refactor Content --- .../Volo/CmsKit/Contents/GetContentInput.cs | 8 ++++++ .../CmsKit/Contents/IContentAppService.cs | 4 +-- .../Volo/CmsKit/Contents/ContentAppService.cs | 8 ++++-- .../Controllers/Contents/ContentController.cs | 25 +++++++++++++++++++ .../Contents/ContentViewComponent.cs | 8 +++++- 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs new file mode 100644 index 0000000000..8efddd1e35 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs @@ -0,0 +1,8 @@ +namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents +{ + public class GetContentInput + { + public string EntityType { get; set; } + public string EntityId { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs index 0ac862e787..714fb6e4fb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs @@ -1,10 +1,10 @@ using System.Threading.Tasks; -using Volo.CmsKit.Contents; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { public interface IContentAppService { - Task GetAsync(string entityType, string entityId); + Task GetAsync(GetContentInput input); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index 77f2fe39ef..14dc318a4d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { @@ -15,9 +16,12 @@ namespace Volo.CmsKit.Contents _contentRepository = contentRepository; } - public async Task GetAsync(string entityType, string entityId) + public async Task GetAsync(GetContentInput input) { - var entity = await _contentRepository.FindAsync(entityType, entityId); // Tenant??? + var entity = await _contentRepository.FindAsync( + input.EntityType, + input.EntityId, + CurrentTenant.Id); return ObjectMapper.Map(entity); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs new file mode 100644 index 0000000000..260668e52d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Controllers.Contents +{ + public class ContentController : CmsKitControllerBase, IContentAppService + { + protected readonly IContentAppService _contentAppService; + + public ContentController(IContentAppService contentAppService) + { + _contentAppService = contentAppService; + } + + public virtual Task GetAsync(GetContentInput input) + { + return _contentAppService.GetAsync(input); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs index 012768b0d7..14522303c6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; +using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; using Volo.CmsKit.Contents; using Volo.CmsKit.Web.Contents; @@ -30,7 +31,12 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents string entityType, string entityId) { - var content = await contentAppService.GetAsync(entityType, entityId); + var content = await contentAppService.GetAsync(new GetContentInput + { + EntityId = entityId, + EntityType = entityType + }); + var viewModel = new ContentViewModel { EntityId = entityId, From a80aeb940a951514108fd1094369132914301fea Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:05:35 +0300 Subject: [PATCH 20/53] CmsKit Tags Scheme Update --- .../Volo/CmsKit/Tags/EntityTag.cs | 6 ++-- .../Volo/CmsKit/Tags/ITagRepository.cs | 7 +++++ .../CmsKitDbContextModelCreatingExtensions.cs | 4 +-- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 31 +++++++++++++++++-- .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 6 ++++ 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs index 5825f32936..e69dbf53aa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs @@ -8,7 +8,7 @@ namespace Volo.CmsKit.Tags { public virtual Guid TagId { get; set; } - public virtual Guid EntityId { get; set; } + public virtual string EntityId { get; set; } public virtual Guid? TenantId { get; } @@ -16,7 +16,7 @@ namespace Volo.CmsKit.Tags { } - public EntityTag(Guid tagId, Guid entityId, Guid? tenantId = null) + public EntityTag(Guid tagId, string entityId, Guid? tenantId = null) { TagId = tagId; EntityId = entityId; @@ -25,7 +25,7 @@ namespace Volo.CmsKit.Tags public override object[] GetKeys() { - return new object[] { TagId, EntityId, TenantId }; + return new object[] { TagId, EntityId }; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs index 8cfeee9551..c33c577422 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -25,5 +26,11 @@ namespace Volo.CmsKit.Tags [NotNull] string name, Guid? tenantId, CancellationToken cancellationToken = default); + + Task> GetAllRelatedTagsAsync( + [NotNull] string entityType, + [NotNull] string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default); } } 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 f7cdb5b59e..2d6441b19e 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 @@ -117,7 +117,7 @@ namespace Volo.CmsKit.EntityFrameworkCore b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); - b.Property(x => x.HexColor).IsRequired().HasMaxLength(TagConsts.MaxColorHexLength); + b.Property(x => x.HexColor).HasMaxLength(TagConsts.MaxColorHexLength); b.HasIndex(x => new { x.TenantId, x.Name }); }); @@ -128,7 +128,7 @@ namespace Volo.CmsKit.EntityFrameworkCore b.ConfigureByConvention(); - b.HasKey(x => new { x.TenantId, x.EntityId, x.TagId }); + b.HasKey(x => new { x.EntityId, x.TagId }); b.Property(x => x.EntityId).IsRequired(); b.Property(x => x.TagId).IsRequired(); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 8a530ba705..5bbecd3629 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -1,11 +1,14 @@ using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.VirtualFileSystem; using Volo.CmsKit.EntityFrameworkCore; namespace Volo.CmsKit.Tags @@ -16,7 +19,7 @@ namespace Volo.CmsKit.Tags { } - public Task AnyAsync( + public virtual Task AnyAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId, @@ -29,7 +32,7 @@ namespace Volo.CmsKit.Tags cancellationToken); } - public Task GetAsync( + public virtual Task GetAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId, @@ -42,7 +45,7 @@ namespace Volo.CmsKit.Tags cancellationToken: cancellationToken); } - public Task FindAsync( + public virtual Task FindAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId, @@ -54,5 +57,27 @@ namespace Volo.CmsKit.Tags x.TenantId == tenantId, cancellationToken: cancellationToken); } + + public virtual async Task> GetAllRelatedTagsAsync( + [NotNull] string entityType, + [NotNull] string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + + var query = DbContext.Set() + .Where(x => + x.EntityId == entityId && + x.TenantId == tenantId + ) + .Join( + DbSet, + o => o.TagId, + i => i.Id, + (entityTag, tag) => tag) + .Where(x => x.EntityType == entityType); + + return await query.ToListAsync(); + } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 9d4644e47b..ca88721460 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using MongoDB.Driver.Linq; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.MongoDB; @@ -54,5 +55,10 @@ namespace Volo.CmsKit.MongoDB.Tags x.TenantId == tenantId, cancellationToken: cancellationToken); } + + public Task> GetAllRelatedTagsAsync([NotNull] string entityType, [NotNull] string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } } } From 7e7dd42f2d6b646a1fa63218622f46f365a37790 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:06:09 +0300 Subject: [PATCH 21/53] Rename CmsKitAppService --- .../Volo/CmsKit/{CmsKitAdminAppService.cs => CmsKitAppService.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/{CmsKitAdminAppService.cs => CmsKitAppService.cs} (100%) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppService.cs similarity index 100% rename from modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAdminAppService.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppService.cs From 65e481b0158039a768ceac4e754c91fb4042c83d Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:07:07 +0300 Subject: [PATCH 22/53] CmsKit Tags AppServices & ViewComponent --- .../Volo/CmsKit/Tags/GetRelatedTagsInput.cs | 16 +++++ .../Volo/CmsKit/Tags/ITagAppService.cs | 11 ++++ .../Volo/CmsKit/Tags/TagDto.cs | 14 +++++ ...msKitCommonApplicationAutoMapperProfile.cs | 3 + .../Volo/CmsKit/Tags/TagAppService.cs | 58 +++++++++++++++++++ .../CmsKit/Controllers/Tags/TagController.cs | 22 +++++++ .../Shared/Components/Tags/Default.cshtml | 13 +++++ .../Components/Tags/TagViewComponent.cs | 51 ++++++++++++++++ .../CmsKit/Shared/Components/Tags/default.css | 4 ++ .../Volo.CmsKit.Common.Web.csproj | 4 ++ 10 files changed, 196 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/ITagAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs new file mode 100644 index 0000000000..0019bbd661 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Volo.CmsKit.Tags +{ + public class GetRelatedTagsInput + { + [Required] + public string EntityType { get; set; } + + [Required] + public string EntityId { get; set; } + + public List Tags { get; set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/ITagAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/ITagAppService.cs new file mode 100644 index 0000000000..f831d0f735 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/ITagAppService.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace Volo.CmsKit.Tags +{ + public interface ITagAppService : IApplicationService + { + Task> GetAllRelatedTagsAsync(GetRelatedTagsInput input); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs new file mode 100644 index 0000000000..4b9e4a5897 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Tags +{ + public class TagDto : EntityDto + { + public string EntityType { get; set; } + + public string Name { get; protected set; } + + public string HexColor { get; protected set; } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs index b7cb5e2210..c7be0fcc69 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs @@ -1,5 +1,6 @@ using AutoMapper; using Volo.CmsKit.Contents; +using Volo.CmsKit.Tags; namespace Volo.CmsKit.Common.Application.Volo.CmsKit { @@ -8,6 +9,8 @@ namespace Volo.CmsKit.Common.Application.Volo.CmsKit public CmsKitCommonApplicationAutoMapperProfile() { CreateMap(); + + CreateMap(); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs new file mode 100644 index 0000000000..c9ddef9629 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Volo.CmsKit.Tags +{ + public class TagAppService : CmsKitAppServiceBase, ITagAppService + { + protected readonly ITagManager TagManager; + protected readonly ITagRepository TagRepository; + protected readonly IEntityTagRepository EntityTagRepository; + + public TagAppService( + ITagManager tagManager, + ITagRepository tagRepository, IEntityTagRepository entityTagRepository) + { + TagManager = tagManager; + TagRepository = tagRepository; + EntityTagRepository = entityTagRepository; + } + + public virtual async Task> GetAllRelatedTagsAsync(GetRelatedTagsInput input) + { + var entities = await TagRepository.GetAllRelatedTagsAsync( + input.EntityType, + input.EntityId, + CurrentTenant.Id); + + if (input.Tags?.Count > 0) + { + var nonExisting = input.Tags + .Where(x => + !entities.Any(a => + a.Name.Equals(x.Trim(), + StringComparison.InvariantCultureIgnoreCase))); + + foreach (var tag in nonExisting) + { + var insertedTag = await TagManager.GetOrAddAsync( + input.EntityType, + tag, + tenantId: CurrentTenant?.Id); + + await EntityTagRepository.InsertAsync( + new EntityTag( + insertedTag.Id, + input.EntityId, + CurrentTenant?.Id)); + + entities.Add(insertedTag); + } + } + + return ObjectMapper.Map, List>(entities); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs new file mode 100644 index 0000000000..b45d7fc6d4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.CmsKit.Controllers; +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.Common.HttpApi.Volo.CmsKit.Controllers.Tags +{ + public class TagController : CmsKitControllerBase, ITagAppService + { + protected readonly ITagAppService TagAppService; + + public TagController(ITagAppService tagAppService) + { + TagAppService = tagAppService; + } + + public Task> GetAllRelatedTagsAsync(GetRelatedTagsInput input) + { + return TagAppService.GetAllRelatedTagsAsync(input); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml new file mode 100644 index 0000000000..e0e9a034a3 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml @@ -0,0 +1,13 @@ +@using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags + +@model TagViewComponent.TagViewModel + +@if (Model.Tags != null) +{ + foreach (var tag in Model.Tags) + { + + @tag.Name + + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs new file mode 100644 index 0000000000..83ad0e7e3a --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs @@ -0,0 +1,51 @@ +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.CmsKit.Tags; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags +{ + [ViewComponent(Name = "CmsTags")] + public class TagViewComponent : AbpViewComponent + { + protected readonly ITagAppService TagAppService; + + public TagViewComponent(ITagAppService tagAppService) + { + TagAppService = tagAppService; + } + + public virtual async Task InvokeAsync( + string entityType, + string entityId, + IEnumerable tags = null) + { + var tagDtos = await TagAppService.GetAllRelatedTagsAsync(new GetRelatedTagsInput + { + EntityId = entityId, + EntityType = entityType, + Tags = tags?.ToList() + }); + + var viewModel = new TagViewModel + { + EntityId = entityId, + EntityType = entityType, + Tags = tagDtos + }; + + return View("~/Pages/CmsKit/Shared/Components/Tags/Default.cshtml", viewModel); + } + + public class TagViewModel + { + public List Tags { get; set; } + public string EntityId { get; set; } + public string EntityType { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css new file mode 100644 index 0000000000..e3f6d69107 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css @@ -0,0 +1,4 @@ +.cmskit-tag { + border-radius: 2px; + border: 1px solid; +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj index 620274f4f3..132e584fc0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj @@ -35,4 +35,8 @@ + + + + From c42e046042c75735a69cfa7cc9eba20e02a248e3 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:08:09 +0300 Subject: [PATCH 23/53] CmsKit Migrations --- .../20201210071514_Initial.Designer.cs | 1414 ----------------- .../20201224075340_Added_ContentAndTags.cs | 99 -- ....cs => 20201224140744_Initial.Designer.cs} | 19 +- ...4_Initial.cs => 20201224140744_Initial.cs} | 85 + .../UnifiedDbContextModelSnapshot.cs | 15 +- 5 files changed, 101 insertions(+), 1531 deletions(-) delete mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.Designer.cs delete mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs rename modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/{20201224075340_Added_ContentAndTags.Designer.cs => 20201224140744_Initial.Designer.cs} (99%) rename modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/{20201210071514_Initial.cs => 20201224140744_Initial.cs} (90%) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.Designer.cs deleted file mode 100644 index 449f18fb53..0000000000 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.Designer.cs +++ /dev/null @@ -1,1414 +0,0 @@ -// -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("20201210071514_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .UseIdentityColumns() - .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.1"); - - 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.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.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.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.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.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.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/20201224075340_Added_ContentAndTags.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs deleted file mode 100644 index 572bef4266..0000000000 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Volo.CmsKit.Migrations -{ - public partial class Added_ContentAndTags : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "CmsContents", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), - ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CmsContents", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "CmsEntityTags", - columns: table => new - { - TagId = table.Column(type: "uniqueidentifier", nullable: false), - EntityId = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CmsEntityTags", x => new { x.TenantId, x.EntityId, x.TagId }); - }); - - migrationBuilder.CreateTable( - name: "CmsTags", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), - Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), - HexColor = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: true), - ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), - CreationTime = table.Column(type: "datetime2", nullable: false), - CreatorId = table.Column(type: "uniqueidentifier", nullable: true), - LastModificationTime = table.Column(type: "datetime2", nullable: true), - LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), - DeleterId = table.Column(type: "uniqueidentifier", nullable: true), - DeletionTime = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_CmsTags", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_CmsContents_TenantId_EntityType_EntityId", - table: "CmsContents", - columns: new[] { "TenantId", "EntityType", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_CmsEntityTags_TenantId_EntityId_TagId", - table: "CmsEntityTags", - columns: new[] { "TenantId", "EntityId", "TagId" }); - - migrationBuilder.CreateIndex( - name: "IX_CmsTags_TenantId_Name", - table: "CmsTags", - columns: new[] { "TenantId", "Name" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CmsContents"); - - migrationBuilder.DropTable( - name: "CmsEntityTags"); - - migrationBuilder.DropTable( - name: "CmsTags"); - } - } -} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.Designer.cs similarity index 99% rename from modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs rename to modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.Designer.cs index 28f86174e7..7ced9b3a54 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224075340_Added_ContentAndTags.Designer.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.Designer.cs @@ -11,8 +11,8 @@ using Volo.CmsKit.EntityFrameworkCore; namespace Volo.CmsKit.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20201224075340_Added_ContentAndTags")] - partial class Added_ContentAndTags + [Migration("20201224140744_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -1251,17 +1251,17 @@ namespace Volo.CmsKit.Migrations modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => { - b.Property("TenantId") - .HasColumnType("uniqueidentifier") - .HasColumnName("TenantId"); - - b.Property("EntityId") - .HasColumnType("uniqueidentifier"); + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); b.Property("TagId") .HasColumnType("uniqueidentifier"); - b.HasKey("TenantId", "EntityId", "TagId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); b.HasIndex("TenantId", "EntityId", "TagId"); @@ -1306,7 +1306,6 @@ namespace Volo.CmsKit.Migrations .HasColumnName("ExtraProperties"); b.Property("HexColor") - .IsRequired() .HasMaxLength(6) .HasColumnType("nvarchar(6)"); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.cs similarity index 90% rename from modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.cs rename to modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.cs index 54f7ac975c..826acae0d9 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201210071514_Initial.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201224140744_Initial.cs @@ -269,6 +269,43 @@ namespace Volo.CmsKit.Migrations table.PrimaryKey("PK_CmsComments", x => x.Id); }); + migrationBuilder.CreateTable( + name: "CmsContents", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + EntityId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Value = table.Column(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsContents", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CmsEntityTags", + columns: table => new + { + TagId = table.Column(type: "uniqueidentifier", nullable: false), + EntityId = table.Column(type: "nvarchar(450)", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsEntityTags", x => new { x.EntityId, x.TagId }); + }); + migrationBuilder.CreateTable( name: "CmsRatings", columns: table => new @@ -286,6 +323,30 @@ namespace Volo.CmsKit.Migrations table.PrimaryKey("PK_CmsRatings", x => x.Id); }); + migrationBuilder.CreateTable( + name: "CmsTags", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + EntityType = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + Name = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), + HexColor = table.Column(type: "nvarchar(6)", maxLength: 6, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsTags", x => x.Id); + }); + migrationBuilder.CreateTable( name: "CmsUserReactions", columns: table => new @@ -736,11 +797,26 @@ namespace Volo.CmsKit.Migrations table: "CmsComments", columns: new[] { "TenantId", "RepliedCommentId" }); + migrationBuilder.CreateIndex( + name: "IX_CmsContents_TenantId_EntityType_EntityId", + table: "CmsContents", + columns: new[] { "TenantId", "EntityType", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_CmsEntityTags_TenantId_EntityId_TagId", + table: "CmsEntityTags", + columns: new[] { "TenantId", "EntityId", "TagId" }); + migrationBuilder.CreateIndex( name: "IX_CmsRatings_TenantId_EntityType_EntityId_CreatorId", table: "CmsRatings", columns: new[] { "TenantId", "EntityType", "EntityId", "CreatorId" }); + migrationBuilder.CreateIndex( + name: "IX_CmsTags_TenantId_Name", + table: "CmsTags", + columns: new[] { "TenantId", "Name" }); + migrationBuilder.CreateIndex( name: "IX_CmsUserReactions_TenantId_CreatorId_EntityType_EntityId_ReactionName", table: "CmsUserReactions", @@ -815,9 +891,18 @@ namespace Volo.CmsKit.Migrations migrationBuilder.DropTable( name: "CmsComments"); + migrationBuilder.DropTable( + name: "CmsContents"); + + migrationBuilder.DropTable( + name: "CmsEntityTags"); + migrationBuilder.DropTable( name: "CmsRatings"); + migrationBuilder.DropTable( + name: "CmsTags"); + migrationBuilder.DropTable( name: "CmsUserReactions"); 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 78f5a086d4..49468416a0 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 @@ -1249,17 +1249,17 @@ namespace Volo.CmsKit.Migrations modelBuilder.Entity("Volo.CmsKit.Tags.EntityTag", b => { - b.Property("TenantId") - .HasColumnType("uniqueidentifier") - .HasColumnName("TenantId"); - - b.Property("EntityId") - .HasColumnType("uniqueidentifier"); + b.Property("EntityId") + .HasColumnType("nvarchar(450)"); b.Property("TagId") .HasColumnType("uniqueidentifier"); - b.HasKey("TenantId", "EntityId", "TagId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.HasKey("EntityId", "TagId"); b.HasIndex("TenantId", "EntityId", "TagId"); @@ -1304,7 +1304,6 @@ namespace Volo.CmsKit.Migrations .HasColumnName("ExtraProperties"); b.Property("HexColor") - .IsRequired() .HasMaxLength(6) .HasColumnType("nvarchar(6)"); From 16ff0a25f252fc909d3c1e41b703547168ecc384 Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:08:42 +0300 Subject: [PATCH 24/53] CmsKit Tags presentation --- .../Pages/Index.cshtml | 24 ++++++++++++++++++- .../Pages/_ViewImports.cshtml | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) 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 78986a8a99..1bfd46cdac 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,6 +8,7 @@ @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.Contents +@using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags @model IndexModel @inject IStringLocalizer Localizer

CMS Kit DEMO

@@ -17,11 +18,20 @@ @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = "quote", entityId = "1" }) - + + @await Component.InvokeAsync(typeof(TagViewComponent), new + { + entityType = "quote", + entityId = "1", + tags = new List { "a", "b" } + }) + + + @if (GlobalFeatureManager.Instance.IsEnabled()) @@ -72,3 +82,15 @@ } + + + + + @await Component.InvokeAsync(typeof(TagViewComponent), new + { + entityType = "IndexPage", + entityId = Guid.Empty.ToString(), + tags = new List { "a", "b" } + }) + + diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml index da4fb49a47..b059f6fec9 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml @@ -3,3 +3,4 @@ @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling @addTagHelper *, Volo.CmsKit.Public.Web +@addTagHelper *, Volo.CmsKit.Common.Web From 995a4e2ff2bd1270890bf500d24386cc1a3aa06f Mon Sep 17 00:00:00 2001 From: enisn Date: Thu, 24 Dec 2020 17:29:34 +0300 Subject: [PATCH 25/53] Fix naming convention of ContentRepository --- .../Volo/CmsKit/Contents/ContentAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index a256277780..a26dd1f006 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -18,7 +18,7 @@ namespace Volo.CmsKit.Contents public virtual async Task GetAsync(GetContentInput input) { - var entity = await _contentRepository.FindAsync( + var entity = await ContentRepository.FindAsync( input.EntityType, input.EntityId, CurrentTenant.Id); From 16031038833688ecde7d3610640d6519cf908895 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 12:19:31 +0300 Subject: [PATCH 26/53] Created and configured Page entity --- .../Volo/CmsKit/Pages/PageConsts.cs | 11 ++++++ .../Volo/CmsKit/Pages/IPageRepository.cs | 10 +++++ .../Volo/CmsKit/Pages/Page.cs | 38 +++++++++++++++++++ .../CmsKitDbContextModelCreatingExtensions.cs | 14 +++++++ .../CmsKitEntityFrameworkCoreModule.cs | 2 + .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 14 +++++++ .../CmsKit/MongoDB/CmsKitMongoDbContext.cs | 3 ++ .../MongoDB/CmsKitMongoDbContextExtensions.cs | 6 +++ .../CmsKit/MongoDB/CmsKitMongoDbModule.cs | 3 ++ .../CmsKit/MongoDB/ICmsKitMongoDbContext.cs | 3 ++ .../MongoDB/Pages/MongoPageRepository.cs | 14 +++++++ 11 files changed, 118 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs 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 new file mode 100644 index 0000000000..f0b5032ee7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Pages/PageConsts.cs @@ -0,0 +1,11 @@ +namespace Volo.CmsKit.Pages +{ + public class PageConsts + { + public const int MaxTitleLength = 256; + + public const int MaxUrlLength = 256; + + public const int MaxDescriptionLength = 515; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs new file mode 100644 index 0000000000..938bbf9cd4 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -0,0 +1,10 @@ +using System; +using Volo.Abp.Domain.Repositories; + +namespace Volo.CmsKit.Pages +{ + public interface IPageRepository : IBasicRepository + { + + } +} \ 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 new file mode 100644 index 0000000000..0a4dd57cc5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs @@ -0,0 +1,38 @@ +using System; +using JetBrains.Annotations; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace Volo.CmsKit.Pages +{ + public class Page : FullAuditedAggregateRoot, IMultiTenant + { + public Guid? TenantId { get; } + + public virtual string Title { get; set; } + + public virtual string Description { get; set; } + + public virtual string Url { get; set; } + + protected Page() + { + + } + + public Page(Guid id, [NotNull] string title, [CanBeNull] string description, [CanBeNull] string url = null, Guid? tenantId = null) : base(id) + { + Title = Check.NotNullOrWhiteSpace(title, nameof(title), PageConsts.MaxTitleLength); + Description = Check.Length(description, nameof(description), PageConsts.MaxDescriptionLength); + SetUrl(url); + + TenantId = tenantId; + } + + public virtual void SetUrl(string url) + { + Url = Check.Length(url, nameof(url), PageConsts.MaxUrlLength); + } + } +} \ 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 2d6441b19e..200401e4c2 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 @@ -10,6 +10,7 @@ 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; using Volo.CmsKit.Tags; @@ -135,6 +136,19 @@ namespace Volo.CmsKit.EntityFrameworkCore b.HasIndex(x => new { x.TenantId, x.EntityId, x.TagId }); }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Pages", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.Title).IsRequired().HasMaxLength(PageConsts.MaxTitleLength); + b.Property(x => x.Url).IsRequired().HasMaxLength(PageConsts.MaxUrlLength); + b.Property(x => x.Description).HasMaxLength(PageConsts.MaxDescriptionLength); + + b.HasIndex(x => new { x.TenantId, x.Url }); + }); } } } 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 7e2057c6f0..c995c21dfb 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 @@ -4,6 +4,7 @@ using Volo.Abp.Modularity; using Volo.Abp.Users.EntityFrameworkCore; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Tags; @@ -29,6 +30,7 @@ namespace Volo.CmsKit.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs new file mode 100644 index 0000000000..9c3b323f45 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.CmsKit.EntityFrameworkCore; + +namespace Volo.CmsKit.Pages +{ + public class EfCorePageRepository : EfCoreRepository, IPageRepository + { + public EfCorePageRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} \ No newline at end of file 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 965cf917ec..c61d8d9a13 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 @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Tags; @@ -27,6 +28,8 @@ namespace Volo.CmsKit.MongoDB public IMongoCollection Tags => Collection(); public IMongoCollection EntityTags => Collection(); + + public IMongoCollection Pages => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { 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 f208e5644c..7f6dcfecf3 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 @@ -3,6 +3,7 @@ using Volo.Abp; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Tags; @@ -58,6 +59,11 @@ namespace Volo.CmsKit.MongoDB { x.CollectionName = CmsKitDbProperties.DbTablePrefix + "EntityTags"; }); + + builder.Entity(x => + { + x.CollectionName = CmsKitDbProperties.DbTablePrefix + "Pages"; + }); } } } 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 d86e727a09..898b1687a8 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 @@ -6,10 +6,12 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.MongoDB.Comments; using Volo.CmsKit.MongoDB.Contents; +using Volo.CmsKit.MongoDB.Pages; using Volo.CmsKit.MongoDB.Ratings; using Volo.CmsKit.MongoDB.Reactions; using Volo.CmsKit.MongoDB.Tags; using Volo.CmsKit.MongoDB.Users; +using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Tags; @@ -35,6 +37,7 @@ namespace Volo.CmsKit.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } 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 5d16305567..d33a5ee371 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 @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Tags; @@ -27,5 +28,7 @@ namespace Volo.CmsKit.MongoDB IMongoCollection Tags { get; } IMongoCollection EntityTags { get; } + + IMongoCollection Pages { get; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs new file mode 100644 index 0000000000..adf3d85dca --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.MongoDB.Pages +{ + public class MongoPageRepository : MongoDbRepository, IPageRepository + { + public MongoPageRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + } +} \ No newline at end of file From d0c58bb55433a82258dba99d5c33270a674d9af8 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 12:32:05 +0300 Subject: [PATCH 27/53] Added delete method to Content repository --- .../Volo/CmsKit/Contents/IContentRepository.cs | 2 ++ .../Volo/CmsKit/Contents/EfCoreContentRepository.cs | 9 +++++++++ .../CmsKit/MongoDB/Contents/MongoContentRepository.cs | 9 +++++++++ 3 files changed, 20 insertions(+) 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 index 2adbab8e5a..2ebd53ce57 100644 --- 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 @@ -13,5 +13,7 @@ namespace Volo.CmsKit.Contents [NotNull] string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default); + + Task DeleteAsync([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 index 3522eed022..ed9fe6e0ab 100644 --- 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 @@ -27,5 +27,14 @@ namespace Volo.CmsKit.Contents cancellationToken: cancellationToken ); } + + public Task DeleteAsync(string entityType, string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default) + { + return DeleteAsync(x => + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } \ No newline at end of file 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 index f9a65bb469..01542a05f0 100644 --- 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 @@ -27,5 +27,14 @@ namespace Volo.CmsKit.MongoDB.Contents cancellationToken: cancellationToken ); } + + public Task DeleteAsync(string entityType, string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default) + { + return DeleteAsync(x => + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken); + } } } \ No newline at end of file From 98ed089d80d0ca82a54328d5b32ad4449da8771e Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 12:35:27 +0300 Subject: [PATCH 28/53] Added Get method to Content Repository --- .../Volo/CmsKit/Contents/IContentRepository.cs | 6 ++++++ .../CmsKit/Contents/EfCoreContentRepository.cs | 15 +++++++++++++++ .../MongoDB/Contents/MongoContentRepository.cs | 15 +++++++++++++++ 3 files changed, 36 insertions(+) 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 index 2ebd53ce57..acd5ed2a84 100644 --- 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 @@ -8,6 +8,12 @@ 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, 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 index ed9fe6e0ab..d426d1d7c5 100644 --- 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 @@ -13,6 +13,21 @@ namespace Volo.CmsKit.Contents { } + public Task GetAsync( + string entityType, + string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + return GetAsync(x => + !x.IsDeleted && + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken + ); + } + public Task FindAsync( string entityType, string entityId, 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 index 01542a05f0..fd673cb34c 100644 --- 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 @@ -13,6 +13,21 @@ namespace Volo.CmsKit.MongoDB.Contents { } + public Task GetAsync( + string entityType, + string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) + { + return GetAsync(x => + !x.IsDeleted && + x.EntityType == entityType && + x.EntityId == entityId && + x.TenantId == tenantId, + cancellationToken: cancellationToken + ); + } + public Task FindAsync( string entityType, string entityId, From 995faff4ba12c79d209d5183e163b4cd1546caf6 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 12:35:52 +0300 Subject: [PATCH 29/53] Update ContentAppService.cs --- .../Volo/CmsKit/Contents/ContentAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index a26dd1f006..072a68b38d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -18,7 +18,7 @@ namespace Volo.CmsKit.Contents public virtual async Task GetAsync(GetContentInput input) { - var entity = await ContentRepository.FindAsync( + var entity = await ContentRepository.GetAsync( input.EntityType, input.EntityId, CurrentTenant.Id); From aa71e2c541d1242b0e90e4a60ca75b74d093d298 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 12:38:32 +0300 Subject: [PATCH 30/53] Added setValue method to content entity --- .../Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 index 2c3cd28593..354041b51b 100644 --- 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 @@ -14,7 +14,7 @@ namespace Volo.CmsKit.Contents public virtual string EntityId { get; set; } - public virtual string Value { get; set; } + public virtual string Value { get; protected set; } protected Content() { @@ -25,9 +25,14 @@ namespace Volo.CmsKit.Contents { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength); EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength); - Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength); + SetValue(value); TenantId = tenantId; } + + public void SetValue([NotNull] string value) + { + Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength); + } } } From e404c3053252493b28fe40df479eb229ea062a53 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 14:25:55 +0300 Subject: [PATCH 31/53] Created Page application service --- .../Volo/CmsKit/Contents/GetContentInput.cs | 2 +- .../CmsKit/Contents/IContentAppService.cs | 1 - .../Volo/CmsKit/Pages/CheckUrlInputDto.cs | 12 +++ .../Volo/CmsKit/Pages/CreatePageInputDto.cs | 19 ++++ .../Pages/CreatePageWithContentInputDto.cs | 24 +++++ .../Volo/CmsKit/Pages/IPageAppService.cs | 20 ++++ .../Volo/CmsKit/Pages/PageDto.cs | 14 +++ .../Volo/CmsKit/Pages/PageWithContentDto.cs | 17 +++ .../CmsKit/Pages/UpdatePageContentInputDto.cs | 13 +++ .../Volo/CmsKit/Pages/UpdatePageInputDto.cs | 19 ++++ ...tAppService.cs => CmsKitAppServiceBase.cs} | 0 ...msKitCommonApplicationAutoMapperProfile.cs | 5 +- .../Volo/CmsKit/Contents/ContentAppService.cs | 1 - .../Volo/CmsKit/Pages/PageAppService.cs | 100 ++++++++++++++++++ .../Controllers/Contents/ContentController.cs | 1 - .../Contents/ContentViewComponent.cs | 1 - .../Volo/CmsKit/Pages/PageConsts.cs | 6 +- .../Volo/CmsKit/Pages/IPageRepository.cs | 7 +- .../Volo/CmsKit/Pages/Page.cs | 13 +-- .../Volo/CmsKit/Pages/EfCorePageRepository.cs | 17 +++ .../MongoDB/Pages/MongoPageRepository.cs | 17 +++ 21 files changed, 290 insertions(+), 19 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageWithContentDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs rename modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/{CmsKitAppService.cs => CmsKitAppServiceBase.cs} (100%) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs index 8efddd1e35..ab3bafc51f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/GetContentInput.cs @@ -1,4 +1,4 @@ -namespace Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents +namespace Volo.CmsKit.Contents { public class GetContentInput { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs index 714fb6e4fb..fae0bd5271 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Contents/IContentAppService.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs new file mode 100644 index 0000000000..6047526e03 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace Volo.CmsKit.Pages +{ + public class CheckUrlInputDto + { + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs new file mode 100644 index 0000000000..7f5ce67260 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace Volo.CmsKit.Pages +{ + public class CreatePageInputDto + { + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] + public string Title { get; set; } + + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] + public string Url { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs new file mode 100644 index 0000000000..ddbf7ce373 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Pages +{ + public class CreatePageWithContentInputDto + { + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] + public string Title { get; set; } + + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] + public string Url { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] + public string Description { get; set; } + + [Required] + [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] + public string Content { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs new file mode 100644 index 0000000000..0b0cf7d182 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; + +namespace Volo.CmsKit.Pages +{ + public interface IPageAppService + { + Task CreatePageAsync(CreatePageInputDto input); + + Task CreatePageWithContentAsync(CreatePageWithContentInputDto input); + + Task UpdatePageAsync(Guid id, UpdatePageInputDto input); + + Task DoesUrlExistAsync(CheckUrlInputDto input); + + Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input); + + Task DeletePageAsync(Guid id); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageDto.cs new file mode 100644 index 0000000000..e2a10d39b5 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageDto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Pages +{ + public class PageDto : EntityDto + { + public string Title { get; set; } + + public string Url { get; set; } + + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageWithContentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageWithContentDto.cs new file mode 100644 index 0000000000..b9ed14ab0d --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/PageWithContentDto.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.Application.Dtos; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Pages +{ + public class PageWithContentDto : EntityDto + { + public string Title { get; set; } + + public string Url { get; set; } + + public string Description { get; set; } + + public ContentDto Content { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs new file mode 100644 index 0000000000..ba50ae9f30 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Pages +{ + public class UpdatePageContentInputDto + { + [Required] + [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] + public string Content { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs new file mode 100644 index 0000000000..be84b97f4f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace Volo.CmsKit.Pages +{ + public class UpdatePageInputDto + { + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] + public string Title { get; set; } + + [Required] + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] + public string Url { get; set; } + + [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppServiceBase.cs similarity index 100% rename from modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppService.cs rename to modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitAppServiceBase.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs index c7be0fcc69..b0c6388c30 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/CmsKitCommonApplicationAutoMapperProfile.cs @@ -1,8 +1,9 @@ using AutoMapper; using Volo.CmsKit.Contents; +using Volo.CmsKit.Pages; using Volo.CmsKit.Tags; -namespace Volo.CmsKit.Common.Application.Volo.CmsKit +namespace Volo.CmsKit { public class CmsKitCommonApplicationAutoMapperProfile : Profile { @@ -11,6 +12,8 @@ namespace Volo.CmsKit.Common.Application.Volo.CmsKit CreateMap(); CreateMap(); + + CreateMap(); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs index 072a68b38d..c91478dd6a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentAppService.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; namespace Volo.CmsKit.Contents { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs new file mode 100644 index 0000000000..435be73ecd --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs @@ -0,0 +1,100 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.CmsKit.Contents; + +namespace Volo.CmsKit.Pages +{ + public class PageAppService : CmsKitAppServiceBase, IPageAppService + { + protected readonly IPageRepository PageRepository; + protected readonly IContentRepository ContentRepository; + + public PageAppService(IPageRepository pageRepository, IContentRepository contentRepository) + { + PageRepository = pageRepository; + ContentRepository = contentRepository; + } + + public virtual async Task CreatePageAsync(CreatePageInputDto input) + { + var page = await CreatePageAsync(input.Title, input.Url, input.Description); + + await PageRepository.InsertAsync(page); + + return ObjectMapper.Map(page); + } + + public virtual async Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) + { + var page = await CreatePageAsync(input.Title, input.Url, input.Description); + + await PageRepository.InsertAsync(page); + + var content = new Content( + GuidGenerator.Create(), + nameof(Page), + page.Id.ToString(), + input.Content, + page.TenantId); + + await ContentRepository.InsertAsync(content); + + return ObjectMapper.Map(page); + } + + public virtual async Task UpdatePageAsync(Guid id, UpdatePageInputDto input) + { + var page = await PageRepository.GetAsync(id); + + if (page.Url != input.Url) + { + await CheckPageUrlAsync(input.Url); + } + + page.Title = input.Title; + page.Url = input.Url; + page.Description = input.Description; + + await PageRepository.UpdateAsync(page); + + return ObjectMapper.Map(page); + } + + public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) + { + return PageRepository.DoesExistAsync(input.Url); + } + + public virtual async Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) + { + var pageContent = await ContentRepository.GetAsync(nameof(Page), id.ToString()); + + pageContent.SetValue(input.Content); + + await ContentRepository.UpdateAsync(pageContent); + } + + public virtual async Task DeletePageAsync(Guid id) + { + await ContentRepository.DeleteAsync(nameof(Page), id.ToString(), CurrentTenant?.Id, CancellationToken.None); + await PageRepository.DeleteAsync(id, cancellationToken: CancellationToken.None); + } + + protected virtual async Task CreatePageAsync(string title, string url, string description) + { + await CheckPageUrlAsync(url); + + return new Page(GuidGenerator.Create(), title, url, description, CurrentTenant?.Id); + } + + protected virtual async Task CheckPageUrlAsync(string url) + { + if (await PageRepository.DoesExistAsync(url)) + { + throw new UserFriendlyException("Url exist"); + } + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs index 260668e52d..ba108a605c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; using Volo.CmsKit.Contents; namespace Volo.CmsKit.Controllers.Contents diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs index 14522303c6..48a94f827a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; -using Volo.CmsKit.Common.Application.Contracts.Volo.CmsKit.Contents; using Volo.CmsKit.Contents; using Volo.CmsKit.Web.Contents; 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 f0b5032ee7..105566c2bd 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,10 +2,10 @@ { public class PageConsts { - public const int MaxTitleLength = 256; + public static int MaxTitleLength = 256; - public const int MaxUrlLength = 256; + public static int MaxUrlLength = 256; - public const int MaxDescriptionLength = 515; + public static int MaxDescriptionLength = 515; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs index 938bbf9cd4..95c09474aa 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs @@ -1,10 +1,15 @@ using System; +using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; namespace Volo.CmsKit.Pages { public interface IPageRepository : IBasicRepository { - + Task GetByUrlAsync(string url); + + Task FindByUrlAsync(string url); + + Task DoesExistAsync(string url); } } \ 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 0a4dd57cc5..c02617c8d3 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 @@ -12,27 +12,22 @@ namespace Volo.CmsKit.Pages public virtual string Title { get; set; } + public virtual string Url { get; set; } + public virtual string Description { get; set; } - public virtual string Url { get; set; } - protected Page() { } - public Page(Guid id, [NotNull] string title, [CanBeNull] string description, [CanBeNull] string url = null, Guid? tenantId = null) : base(id) + public Page(Guid id, [NotNull] string title, [NotNull] string url, [CanBeNull] string description, Guid? tenantId = null) : base(id) { Title = Check.NotNullOrWhiteSpace(title, nameof(title), PageConsts.MaxTitleLength); + Url = Check.NotNullOrWhiteSpace(url, nameof(url), PageConsts.MaxUrlLength); Description = Check.Length(description, nameof(description), PageConsts.MaxDescriptionLength); - SetUrl(url); TenantId = tenantId; } - - public virtual void SetUrl(string url) - { - Url = Check.Length(url, nameof(url), PageConsts.MaxUrlLength); - } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs index 9c3b323f45..4502a13b4c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs @@ -1,4 +1,6 @@ using System; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; @@ -10,5 +12,20 @@ namespace Volo.CmsKit.Pages public EfCorePageRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task GetByUrlAsync(string url) + { + return GetAsync(x => x.Url == url); + } + + public Task FindByUrlAsync(string url) + { + return FindAsync(x => x.Url == url); + } + + public Task DoesExistAsync(string url) + { + return DbSet.AnyAsync(x => x.Url == url); + } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs index adf3d85dca..e7c6cd32f5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs @@ -1,4 +1,6 @@ using System; +using System.Threading.Tasks; +using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Pages; @@ -10,5 +12,20 @@ namespace Volo.CmsKit.MongoDB.Pages public MongoPageRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public Task GetByUrlAsync(string url) + { + return GetAsync(x => x.Url == url); + } + + public Task FindByUrlAsync(string url) + { + return FindAsync(x => x.Url == url); + } + + public Task DoesExistAsync(string url) + { + return GetMongoQueryable().AnyAsync(x => x.Url == url); + } } } \ No newline at end of file From f7244d1c5b96d46cea1334ca3a9b8996c23023fd Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 14:40:51 +0300 Subject: [PATCH 32/53] namespace update --- .../host/Volo.CmsKit.Web.Unified/Pages/Index.cshtml | 2 +- .../Shared/Components/Contents/ContentViewComponent.cs | 7 +------ .../Pages/CmsKit/Shared/Components/Contents/Default.cshtml | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) 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 1bfd46cdac..b6ce055737 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 @@ -7,7 +7,7 @@ @using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting @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.Contents +@using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Contents @using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags @model IndexModel @inject IStringLocalizer Localizer diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs index 48a94f827a..4e7cc98bd9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/ContentViewComponent.cs @@ -1,16 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.UI; -using Volo.Abp.AspNetCore.Mvc.UI.Widgets; using Volo.CmsKit.Contents; using Volo.CmsKit.Web.Contents; -namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents +namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Contents { [ViewComponent(Name = "CmsContent")] public class ContentViewComponent : AbpViewComponent diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml index f5bd0ba344..eb3cde67b3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Contents/Default.cshtml @@ -1,7 +1,6 @@ @using Microsoft.AspNetCore.Mvc.Localization @using Volo.CmsKit.Localization -@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents -@model ContentViewComponent.ContentViewModel +@model Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Contents.ContentViewComponent.ContentViewModel
@Html.Raw(Model.Rendered) From 009ba05b3465313de6f103e8189660312c596cf8 Mon Sep 17 00:00:00 2001 From: Ilkay Ilknur Date: Fri, 25 Dec 2020 14:48:29 +0300 Subject: [PATCH 33/53] tag and content features has been added. --- .../Pages/Index.cshtml | 54 ++++++++++--------- .../CmsKit/GlobalFeatures/ContentsFeature.cs | 17 ++++++ .../GlobalFeatures/GlobalCmsKitFeatures.cs | 4 ++ .../Volo/CmsKit/GlobalFeatures/TagsFeature.cs | 17 ++++++ 4 files changed, 67 insertions(+), 25 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/TagsFeature.cs 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 1bfd46cdac..95833052b7 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 @@ -16,39 +16,41 @@ - - @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = "quote", entityId = "1" }) - - @await Component.InvokeAsync(typeof(TagViewComponent), new + @if (GlobalFeatureManager.Instance.IsEnabled()) { - entityType = "quote", - entityId = "1", - tags = new List { "a", "b" } - }) - + @await Component.InvokeAsync(typeof(ContentViewComponent), new {entityType = "quote", entityId = "1"}) + } + + @if (GlobalFeatureManager.Instance.IsEnabled()) + { + @await Component.InvokeAsync(typeof(TagViewComponent), new + { + entityType = "quote", + entityId = "1", + tags = new List {"a", "b"} + }) + } - - @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(RatingViewComponent), new { entityType = "quote", entityId = "1" }) + @await Component.InvokeAsync(typeof(RatingViewComponent), new {entityType = "quote", entityId = "1"}) } @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new { entityType = "quote", entityId = "1" }) + @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new {entityType = "quote", entityId = "1"}) } @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(CommentingViewComponent), new { entityType = "quote", entityId = "1" }) + @await Component.InvokeAsync(typeof(CommentingViewComponent), new {entityType = "quote", entityId = "1"}) } @@ -58,7 +60,7 @@

"Writing code is very simple, but writing simple code is the hardest thing there is!"

-

- Halil ibrahim Kalkan Inspired from Johan Cruyff

+

- Halil ibrahim Kalkan Inspired from Johan Cruyff

@@ -66,31 +68,33 @@ @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(RatingViewComponent), new { entityType = "quote", entityId = "2" }) + @await Component.InvokeAsync(typeof(RatingViewComponent), new {entityType = "quote", entityId = "2"}) } @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new { entityType = "quote", entityId = "2" }) + @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new {entityType = "quote", entityId = "2"}) } @if (GlobalFeatureManager.Instance.IsEnabled()) { - @await Component.InvokeAsync(typeof(CommentingViewComponent), new { entityType = "quote", entityId = "2" }) + @await Component.InvokeAsync(typeof(CommentingViewComponent), new {entityType = "quote", entityId = "2"}) } - - @await Component.InvokeAsync(typeof(TagViewComponent), new + @if (GlobalFeatureManager.Instance.IsEnabled()) { - entityType = "IndexPage", - entityId = Guid.Empty.ToString(), - tags = new List { "a", "b" } - }) + @await Component.InvokeAsync(typeof(TagViewComponent), new + { + entityType = "IndexPage", + entityId = Guid.Empty.ToString(), + tags = new List {"a", "b"} + }) + } - + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs new file mode 100644 index 0000000000..6514a9c7b8 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/ContentsFeature.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using Volo.Abp.GlobalFeatures; + +namespace Volo.CmsKit.GlobalFeatures +{ + [GlobalFeatureName(Name)] + public class ContentsFeature : GlobalFeature + { + public const string Name = "CmsKit.Contents"; + + internal ContentsFeature( + [NotNull] GlobalCmsKitFeatures cmsKit + ) : base(cmsKit) + { + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs index bb7694262b..db987784fd 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/GlobalCmsKitFeatures.cs @@ -13,12 +13,16 @@ namespace Volo.CmsKit.GlobalFeatures public RatingsFeature Ratings => GetFeature(); + public TagsFeature Tags => GetFeature(); + public GlobalCmsKitFeatures([NotNull] GlobalFeatureManager featureManager) : base(featureManager) { AddFeature(new ReactionsFeature(this)); AddFeature(new CommentsFeature(this)); AddFeature(new RatingsFeature(this)); + AddFeature(new TagsFeature(this)); + AddFeature(new ContentsFeature(this)); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/TagsFeature.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/TagsFeature.cs new file mode 100644 index 0000000000..ff20c130fd --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/GlobalFeatures/TagsFeature.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using Volo.Abp.GlobalFeatures; + +namespace Volo.CmsKit.GlobalFeatures +{ + [GlobalFeatureName(Name)] + public class TagsFeature : GlobalFeature + { + public const string Name = "CmsKit.Tags"; + + internal TagsFeature( + [NotNull] GlobalCmsKitFeatures cmsKit + ) : base(cmsKit) + { + } + } +} \ No newline at end of file From c1561f4e732aeb12cc957a6bbdbb10e635445f71 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Fri, 25 Dec 2020 16:04:48 +0300 Subject: [PATCH 34/53] added default page view component --- .../20201225120048_Added_Page.Designer.cs | 1647 +++++++++++++++++ .../Migrations/20201225120048_Added_Page.cs | 46 + .../UnifiedDbContextModelSnapshot.cs | 71 + .../CmsKit/CmsKitCommonRemoteServiceConsts.cs | 7 + .../Volo/CmsKit/Pages/CheckUrlInputDto.cs | 1 - .../Volo/CmsKit/Pages/CreatePageInputDto.cs | 3 - .../Pages/CreatePageWithContentInputDto.cs | 4 - .../Volo/CmsKit/Pages/IPageAppService.cs | 4 +- .../CmsKit/Pages/UpdatePageContentInputDto.cs | 1 - .../Volo/CmsKit/Pages/UpdatePageInputDto.cs | 3 - .../Volo/CmsKit/Pages/PageAppService.cs | 9 +- .../Controllers/Contents/ContentController.cs | 13 +- .../Controllers/Pages/PageController.cs | 70 + .../CmsKit/Controllers/Tags/TagController.cs | 9 +- .../Shared/Components/Pages/Default.cshtml | 21 + .../Pages/DefaultPageViewComponent.cs | 40 + 16 files changed, 1928 insertions(+), 21 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/CmsKitCommonRemoteServiceConsts.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.Designer.cs new file mode 100644 index 0000000000..06fcbe43a4 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.Designer.cs @@ -0,0 +1,1647 @@ +// +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("20201225120048_Added_Page")] + partial class Added_Page + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + 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.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.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.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("Description") + .HasMaxLength(515) + .HasColumnType("nvarchar(515)"); + + 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("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + 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("HexColor") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + 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.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.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/20201225120048_Added_Page.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.cs new file mode 100644 index 0000000000..119009c8e1 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201225120048_Added_Page.cs @@ -0,0 +1,46 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Added_Page : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "CmsPages", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + Title = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), + Description = table.Column(type: "nvarchar(515)", maxLength: 515, nullable: true), + ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), + CreationTime = table.Column(type: "datetime2", nullable: false), + CreatorId = table.Column(type: "uniqueidentifier", nullable: true), + LastModificationTime = table.Column(type: "datetime2", nullable: true), + LastModifierId = table.Column(type: "uniqueidentifier", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uniqueidentifier", nullable: true), + DeletionTime = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CmsPages", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_CmsPages_TenantId_Url", + table: "CmsPages", + columns: new[] { "TenantId", "Url" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "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 49468416a0..592e827b82 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 @@ -1168,6 +1168,77 @@ namespace Volo.CmsKit.Migrations b.ToTable("CmsContents"); }); + 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("Description") + .HasMaxLength(515) + .HasColumnType("nvarchar(515)"); + + 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("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + b.ToTable("CmsPages"); + }); + modelBuilder.Entity("Volo.CmsKit.Ratings.Rating", b => { b.Property("Id") diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/CmsKitCommonRemoteServiceConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/CmsKitCommonRemoteServiceConsts.cs new file mode 100644 index 0000000000..aa0412f026 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/CmsKitCommonRemoteServiceConsts.cs @@ -0,0 +1,7 @@ +namespace Volo.CmsKit +{ + public class CmsKitCommonRemoteServiceConsts + { + public const string RemoteServiceName = "CmsKitCommon"; + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs index 6047526e03..e46dca2353 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CheckUrlInputDto.cs @@ -6,7 +6,6 @@ namespace Volo.CmsKit.Pages public class CheckUrlInputDto { [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs index 7f5ce67260..b6ce4990f9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageInputDto.cs @@ -6,14 +6,11 @@ namespace Volo.CmsKit.Pages public class CreatePageInputDto { [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs index ddbf7ce373..d9905b83a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/CreatePageWithContentInputDto.cs @@ -7,18 +7,14 @@ namespace Volo.CmsKit.Pages public class CreatePageWithContentInputDto { [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs index 0b0cf7d182..f684fff57b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs @@ -5,6 +5,8 @@ namespace Volo.CmsKit.Pages { public interface IPageAppService { + Task GetAsync(Guid id); + Task CreatePageAsync(CreatePageInputDto input); Task CreatePageWithContentAsync(CreatePageWithContentInputDto input); @@ -15,6 +17,6 @@ namespace Volo.CmsKit.Pages Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input); - Task DeletePageAsync(Guid id); + Task DeleteAsync(Guid id); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs index ba50ae9f30..7a1a89b955 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageContentInputDto.cs @@ -7,7 +7,6 @@ namespace Volo.CmsKit.Pages public class UpdatePageContentInputDto { [Required] - [DynamicMaxLength(typeof(ContentConsts), nameof(ContentConsts.MaxValueLength))] public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs index be84b97f4f..7180d296a3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/UpdatePageInputDto.cs @@ -6,14 +6,11 @@ namespace Volo.CmsKit.Pages public class UpdatePageInputDto { [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxTitleLength))] public string Title { get; set; } [Required] - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxUrlLength))] public string Url { get; set; } - [DynamicMaxLength(typeof(PageConsts), nameof(PageConsts.MaxDescriptionLength))] public string Description { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs index 435be73ecd..2cc93e2988 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs @@ -17,6 +17,13 @@ namespace Volo.CmsKit.Pages ContentRepository = contentRepository; } + public virtual async Task GetAsync(Guid id) + { + var page = await PageRepository.GetAsync(id); + + return ObjectMapper.Map(page); + } + public virtual async Task CreatePageAsync(CreatePageInputDto input) { var page = await CreatePageAsync(input.Title, input.Url, input.Description); @@ -76,7 +83,7 @@ namespace Volo.CmsKit.Pages await ContentRepository.UpdateAsync(pageContent); } - public virtual async Task DeletePageAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { await ContentRepository.DeleteAsync(nameof(Page), id.ToString(), CurrentTenant?.Id, CancellationToken.None); await PageRepository.DeleteAsync(id, cancellationToken: CancellationToken.None); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs index ba108a605c..8e9612b506 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Contents/ContentController.cs @@ -1,12 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; using Volo.CmsKit.Contents; namespace Volo.CmsKit.Controllers.Contents { + + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Route("api/cms-kit/contents")] public class ContentController : CmsKitControllerBase, IContentAppService { protected readonly IContentAppService _contentAppService; @@ -16,6 +18,7 @@ namespace Volo.CmsKit.Controllers.Contents _contentAppService = contentAppService; } + [HttpGet] public virtual Task GetAsync(GetContentInput input) { return _contentAppService.GetAsync(input); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs new file mode 100644 index 0000000000..8c33819ac0 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs @@ -0,0 +1,70 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.Controllers.Pages +{ + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Route("api/cms-kit/pages")] + public class PageController : CmsKitControllerBase, IPageAppService + { + protected readonly IPageAppService PageAppService; + + public PageController(IPageAppService pageAppService) + { + PageAppService = pageAppService; + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return PageAppService.GetAsync(id); + } + + [HttpPost] + [Route("create")] + public virtual Task CreatePageAsync(CreatePageInputDto input) + { + return PageAppService.CreatePageAsync(input); + } + + [HttpPost] + [Route("create-with-content")] + public virtual Task CreatePageWithContentAsync(CreatePageWithContentInputDto input) + { + return PageAppService.CreatePageWithContentAsync(input); + } + + [HttpPut] + [Route("{id}")] + public virtual Task UpdatePageAsync(Guid id, UpdatePageInputDto input) + { + return PageAppService.UpdatePageAsync(id, input); + } + + [HttpPost] + [Route("does-url-exist")] + public virtual Task DoesUrlExistAsync(CheckUrlInputDto input) + { + return PageAppService.DoesUrlExistAsync(input); + } + + [HttpPut] + [Route("update-content/{id}")] + public virtual Task UpdatePageContentAsync(Guid id, UpdatePageContentInputDto input) + { + return PageAppService.UpdatePageContentAsync(id, input); + } + + [HttpDelete] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return PageAppService.DeleteAsync(id); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs index b45d7fc6d4..89f469ef93 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Tags/TagController.cs @@ -1,10 +1,14 @@ using System.Collections.Generic; using System.Threading.Tasks; -using Volo.CmsKit.Controllers; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; using Volo.CmsKit.Tags; -namespace Volo.CmsKit.Common.HttpApi.Volo.CmsKit.Controllers.Tags +namespace Volo.CmsKit.Controllers.Tags { + [RemoteService(Name = CmsKitCommonRemoteServiceConsts.RemoteServiceName)] + [Area("cms-kit")] + [Route("api/cms-kit/tags")] public class TagController : CmsKitControllerBase, ITagAppService { protected readonly ITagAppService TagAppService; @@ -14,6 +18,7 @@ namespace Volo.CmsKit.Common.HttpApi.Volo.CmsKit.Controllers.Tags TagAppService = tagAppService; } + [HttpGet] public Task> GetAllRelatedTagsAsync(GetRelatedTagsInput input) { return TagAppService.GetAllRelatedTagsAsync(input); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml new file mode 100644 index 0000000000..87a326c7ff --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/Default.cshtml @@ -0,0 +1,21 @@ +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap + +@using Microsoft.AspNetCore.Mvc.RazorPages +@using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Contents +@model Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Pages.PageViewModel + + + +

+ @Model.Title +

+
+ + +

+ @Model.Description +

+ + @await Component.InvokeAsync(typeof(ContentViewComponent), new { entityType = nameof(Page), entityId = Model.Id.ToString() }) +
+
diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs new file mode 100644 index 0000000000..62689f6bc1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Pages/DefaultPageViewComponent.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Pages +{ + [ViewComponent(Name = "CmsDefaultPage")] + public class DefaultPageViewComponent : AbpViewComponent + { + protected readonly IPageAppService PageAppService; + + public DefaultPageViewComponent(IPageAppService pageAppService) + { + PageAppService = pageAppService; + } + + public virtual async Task InvokeAsync(Guid pageId, string title, string description) + { + var model = new PageViewModel + { + Id = pageId, + Title = title, + Description = description + }; + + return View("~/Pages/CmsKit/Shared/Components/Pages/Default.cshtml", model); + } + } + + public class PageViewModel + { + public Guid Id { get; set; } + + public string Title { get; set; } + + public string Description { get; set; } + } +} \ No newline at end of file From dc0e83d74fa690c8b8a65afec2f42a3b60508564 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 25 Dec 2020 17:11:19 +0300 Subject: [PATCH 35/53] added GetAllRelatedTagsAsync implementation --- .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index ca88721460..1d5a089da4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; +using MongoDB.Driver; using MongoDB.Driver.Linq; using System; using System.Collections.Generic; @@ -10,7 +11,7 @@ using Volo.CmsKit.Tags; namespace Volo.CmsKit.MongoDB.Tags { - public class MongoTagRepository : MongoDbRepository, ITagRepository + public class MongoTagRepository : MongoDbRepository, ITagRepository { public MongoTagRepository(IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) { @@ -30,7 +31,7 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken); } - public Task GetAsync( + public Task GetAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId, @@ -43,7 +44,7 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken: cancellationToken); } - public Task FindAsync( + public Task FindAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId, @@ -56,9 +57,24 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken: cancellationToken); } - public Task> GetAllRelatedTagsAsync([NotNull] string entityType, [NotNull] string entityId, Guid? tenantId = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAllRelatedTagsAsync( + [NotNull] string entityType, + [NotNull] string entityId, + Guid? tenantId = null, + CancellationToken cancellationToken = default) { - throw new NotImplementedException(); + var entityTagIds = await DbContext.EntityTags.AsQueryable() + .Where(q => q.EntityId == entityId) + .Select(q => q.EntityId) + .ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); + + var query = GetMongoQueryable() + .Where(x => x.EntityType == entityType && + x.TenantId == tenantId && + entityTagIds.Contains(x.Id.ToString())); + + var result = await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); + return result; } } } From 42616f470f14480208184b6ff40a23275cbefc3b Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 25 Dec 2020 17:32:46 +0300 Subject: [PATCH 36/53] Update modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs Co-authored-by: Enis Necipoglu --- .../Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 1d5a089da4..555dad444e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -64,7 +64,7 @@ namespace Volo.CmsKit.MongoDB.Tags CancellationToken cancellationToken = default) { var entityTagIds = await DbContext.EntityTags.AsQueryable() - .Where(q => q.EntityId == entityId) + .Where(q => q.EntityId == entityId && q.TenantId == tenantId) .Select(q => q.EntityId) .ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); From 0d9880eb8a5ebc2110aa7576dd887735e1875f45 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 11:32:04 +0300 Subject: [PATCH 37/53] Remove HexColor from Tag --- ...0_Updated_Tag_Removed_HexColor.Designer.cs | 1643 +++++++++++++++++ ...1228083120_Updated_Tag_Removed_HexColor.cs | 24 + .../UnifiedDbContextModelSnapshot.cs | 4 - .../Volo/CmsKit/Tags/TagDto.cs | 2 - .../Shared/Components/Tags/Default.cshtml | 2 +- .../CmsKit/Shared/Components/Tags/default.css | 4 - .../Volo.CmsKit.Common.Web.csproj | 4 - .../Volo/CmsKit/Tags/TagConsts.cs | 2 - .../Volo/CmsKit/Tags/ITagManager.cs | 3 - .../Volo/CmsKit/Tags/Tag.cs | 9 - .../Volo/CmsKit/Tags/TagManager.cs | 7 +- .../CmsKitDbContextModelCreatingExtensions.cs | 1 - 12 files changed, 1669 insertions(+), 36 deletions(-) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.cs delete mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs new file mode 100644 index 0000000000..8f90204baa --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.Designer.cs @@ -0,0 +1,1643 @@ +// +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("20201228083120_Updated_Tag_Removed_HexColor")] + partial class Updated_Tag_Removed_HexColor + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.1"); + + 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.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.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.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("Description") + .HasMaxLength(515) + .HasColumnType("nvarchar(515)"); + + 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("Title") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Url"); + + 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.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.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/20201228083120_Updated_Tag_Removed_HexColor.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.cs new file mode 100644 index 0000000000..476f4ea87e --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Migrations/20201228083120_Updated_Tag_Removed_HexColor.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.CmsKit.Migrations +{ + public partial class Updated_Tag_Removed_HexColor : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "HexColor", + table: "CmsTags"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "HexColor", + table: "CmsTags", + type: "nvarchar(6)", + maxLength: 6, + nullable: true); + } + } +} 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 592e827b82..37622217c5 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 @@ -1374,10 +1374,6 @@ namespace Volo.CmsKit.Migrations .HasColumnType("nvarchar(max)") .HasColumnName("ExtraProperties"); - b.Property("HexColor") - .HasMaxLength(6) - .HasColumnType("nvarchar(6)"); - b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnType("bit") diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs index 4b9e4a5897..e7d41e6657 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/TagDto.cs @@ -8,7 +8,5 @@ namespace Volo.CmsKit.Tags public string EntityType { get; set; } public string Name { get; protected set; } - - public string HexColor { get; protected set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml index e0e9a034a3..f1dd2008ac 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml @@ -6,7 +6,7 @@ { foreach (var tag in Model.Tags) { - + @tag.Name } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css deleted file mode 100644 index e3f6d69107..0000000000 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/default.css +++ /dev/null @@ -1,4 +0,0 @@ -.cmskit-tag { - border-radius: 2px; - border: 1px solid; -} diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj index 132e584fc0..620274f4f3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Volo.CmsKit.Common.Web.csproj @@ -35,8 +35,4 @@ - - - - diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs index 5affee9c15..4e6c0b38cc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Tags/TagConsts.cs @@ -7,7 +7,5 @@ namespace Volo.CmsKit.Tags public static int MaxEntityTypeLength { get; set; } = CmsEntityConsts.MaxEntityTypeLength; public static int MaxNameLength { get; set; } = 32; - - public static int MaxColorHexLength { get; set; } = 6; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs index b1562a341d..18fea113c0 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs @@ -12,20 +12,17 @@ namespace Volo.CmsKit.Tags Task InsertAsync( [NotNull] string entityType, [NotNull] string name, - [CanBeNull] string hexColor, Guid? tenantId = null, CancellationToken cancellationToken = default); Task UpdateAsync( Guid id, [NotNull] string name, - [CanBeNull] string hexColor, CancellationToken cancellationToken = default); Task GetOrAddAsync( [NotNull] string entityType, [NotNull] string name, - [CanBeNull] string hexColor = null, Guid? tenantId = null, CancellationToken cancellationToken = default); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index a13ea70ba0..9920fa5a3e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -12,8 +12,6 @@ namespace Volo.CmsKit.Tags public string Name { get; protected set; } - public string HexColor { get; protected set; } - public Guid? TenantId { get; } protected Tag() @@ -23,12 +21,10 @@ namespace Volo.CmsKit.Tags public Tag( [NotNull] string entityType, [NotNull] string name, - [CanBeNull] string hexColor, Guid? tenantId = null) { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength); SetName(name); - SetHexColor(hexColor); TenantId = tenantId; } @@ -36,10 +32,5 @@ namespace Volo.CmsKit.Tags { Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength); } - - public void SetHexColor(string hexColor) - { - HexColor = Check.Length(hexColor, nameof(hexColor), TagConsts.MaxColorHexLength); - } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs index c62317cd64..f669298441 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -19,7 +19,6 @@ namespace Volo.CmsKit.Tags public async Task GetOrAddAsync( [NotNull] string entityType, [NotNull] string name, - [CanBeNull] string hexColor = null, Guid? tenantId = null, CancellationToken cancellationToken = default) { @@ -27,7 +26,7 @@ namespace Volo.CmsKit.Tags if (entity == null) { - entity = await InsertAsync(entityType, name, hexColor, tenantId, cancellationToken); + entity = await InsertAsync(entityType, name, tenantId, cancellationToken); } return entity; @@ -36,7 +35,6 @@ namespace Volo.CmsKit.Tags public async Task InsertAsync( [NotNull] string entityType, [NotNull] string name, - [CanBeNull] string hexColor, Guid? tenantId = null, CancellationToken cancellationToken = default) { @@ -49,7 +47,6 @@ namespace Volo.CmsKit.Tags new Tag( entityType, name, - hexColor, tenantId), cancellationToken: cancellationToken); } @@ -57,13 +54,11 @@ namespace Volo.CmsKit.Tags public async Task UpdateAsync( Guid id, [NotNull] string name, - [CanBeNull] string hexColor, CancellationToken cancellationToken = default) { var entity = await _tagRepository.GetAsync(id, cancellationToken: cancellationToken); entity.SetName(name); - entity.SetHexColor(hexColor); if (await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken)) { 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 200401e4c2..8d32de7958 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 @@ -118,7 +118,6 @@ namespace Volo.CmsKit.EntityFrameworkCore b.Property(x => x.EntityType).IsRequired().HasMaxLength(TagConsts.MaxEntityTypeLength); b.Property(x => x.Name).IsRequired().HasMaxLength(TagConsts.MaxNameLength); - b.Property(x => x.HexColor).HasMaxLength(TagConsts.MaxColorHexLength); b.HasIndex(x => new { x.TenantId, x.Name }); }); From 49f3b6a8f4929a11c03f547fb3a340e76ab64fb7 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 11:35:05 +0300 Subject: [PATCH 38/53] Remove static tags logic --- .../Pages/Index.cshtml | 6 ++-- .../Volo/CmsKit/Tags/GetRelatedTagsInput.cs | 2 -- .../Volo/CmsKit/Tags/TagAppService.cs | 28 ++----------------- .../Components/Tags/TagViewComponent.cs | 6 ++-- 4 files changed, 6 insertions(+), 36 deletions(-) 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 b6ce055737..453ef5619e 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 @@ -22,8 +22,7 @@ @await Component.InvokeAsync(typeof(TagViewComponent), new { entityType = "quote", - entityId = "1", - tags = new List { "a", "b" } + entityId = "1" }) @@ -89,8 +88,7 @@ @await Component.InvokeAsync(typeof(TagViewComponent), new { entityType = "IndexPage", - entityId = Guid.Empty.ToString(), - tags = new List { "a", "b" } + entityId = Guid.Empty.ToString() }) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs index 0019bbd661..ca9cd31b16 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Tags/GetRelatedTagsInput.cs @@ -10,7 +10,5 @@ namespace Volo.CmsKit.Tags [Required] public string EntityId { get; set; } - - public List Tags { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs index c9ddef9629..4e096d9bf6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Tags/TagAppService.cs @@ -13,7 +13,8 @@ namespace Volo.CmsKit.Tags public TagAppService( ITagManager tagManager, - ITagRepository tagRepository, IEntityTagRepository entityTagRepository) + ITagRepository tagRepository, + IEntityTagRepository entityTagRepository) { TagManager = tagManager; TagRepository = tagRepository; @@ -27,31 +28,6 @@ namespace Volo.CmsKit.Tags input.EntityId, CurrentTenant.Id); - if (input.Tags?.Count > 0) - { - var nonExisting = input.Tags - .Where(x => - !entities.Any(a => - a.Name.Equals(x.Trim(), - StringComparison.InvariantCultureIgnoreCase))); - - foreach (var tag in nonExisting) - { - var insertedTag = await TagManager.GetOrAddAsync( - input.EntityType, - tag, - tenantId: CurrentTenant?.Id); - - await EntityTagRepository.InsertAsync( - new EntityTag( - insertedTag.Id, - input.EntityId, - CurrentTenant?.Id)); - - entities.Add(insertedTag); - } - } - return ObjectMapper.Map, List>(entities); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs index 83ad0e7e3a..9e787c4d4c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Shared/Components/Tags/TagViewComponent.cs @@ -21,14 +21,12 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags public virtual async Task InvokeAsync( string entityType, - string entityId, - IEnumerable tags = null) + string entityId) { var tagDtos = await TagAppService.GetAllRelatedTagsAsync(new GetRelatedTagsInput { EntityId = entityId, - EntityType = entityType, - Tags = tags?.ToList() + EntityType = entityType }); var viewModel = new TagViewModel From dd95488cb0a50d30637168e3154a485f70715054 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 11:52:21 +0300 Subject: [PATCH 39/53] CmsKit - EfCore Tag Query Update - Convert Join query to seperated queries --- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 5bbecd3629..ea3b3c5bf9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -64,20 +64,17 @@ namespace Volo.CmsKit.Tags Guid? tenantId = null, CancellationToken cancellationToken = default) { + var entityTagIds = await DbContext.Set() + .Where(q => q.EntityId == entityId && q.TenantId == tenantId) + .Select(q => q.EntityId) + .ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); - var query = DbContext.Set() - .Where(x => - x.EntityId == entityId && - x.TenantId == tenantId - ) - .Join( - DbSet, - o => o.TagId, - i => i.Id, - (entityTag, tag) => tag) - .Where(x => x.EntityType == entityType); + var query = DbSet + .Where(x => x.EntityType == entityType && + x.TenantId == tenantId && + entityTagIds.Contains(x.Id.ToString())); - return await query.ToListAsync(); + return await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); } } } From 2cf68eed2ec4e1f4ca33b120d852e432c485df9a Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 12:45:22 +0300 Subject: [PATCH 40/53] Added CmsKit Page --- .../Volo/CmsKit/Pages/IPageAppService.cs | 3 +++ .../Volo/CmsKit/Pages/PageAppService.cs | 7 +++++ .../Controllers/Pages/PageController.cs | 7 +++++ .../Pages/CmsKit/Pages/Index.cshtml | 15 +++++++++++ .../Pages/CmsKit/Pages/Index.cshtml.cs | 26 +++++++++++++++++++ .../Pages/CmsKit/_ViewImports.cshtml | 4 +++ .../Pages/CommonPageModel.cs | 13 ++++++++++ 7 files changed, 75 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/_ViewImports.cshtml create mode 100644 modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CommonPageModel.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs index f684fff57b..ef9c8082df 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application.Contracts/Volo/CmsKit/Pages/IPageAppService.cs @@ -1,11 +1,14 @@ using System; using System.Threading.Tasks; +using JetBrains.Annotations; namespace Volo.CmsKit.Pages { public interface IPageAppService { Task GetAsync(Guid id); + + Task GetByUrlAsync([NotNull] string url); Task CreatePageAsync(CreatePageInputDto input); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs index 2cc93e2988..cc7c177873 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Pages/PageAppService.cs @@ -24,6 +24,13 @@ namespace Volo.CmsKit.Pages return ObjectMapper.Map(page); } + public virtual async Task GetByUrlAsync(string url) + { + var page = await PageRepository.GetByUrlAsync(url); + + return ObjectMapper.Map(page); + } + public virtual async Task CreatePageAsync(CreatePageInputDto input) { var page = await CreatePageAsync(input.Title, input.Url, input.Description); diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs index 8c33819ac0..d16dc97ef1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/Controllers/Pages/PageController.cs @@ -25,6 +25,13 @@ namespace Volo.CmsKit.Controllers.Pages return PageAppService.GetAsync(id); } + [HttpGet] + [Route("url/{url}")] + public Task GetByUrlAsync(string url) + { + return PageAppService.GetByUrlAsync(url); + } + [HttpPost] [Route("create")] public virtual Task CreatePageAsync(CreatePageInputDto input) diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml new file mode 100644 index 0000000000..486b1c78c1 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml @@ -0,0 +1,15 @@ +@page "{pageUrl}" +@using Microsoft.AspNetCore.Mvc.Localization +@using Volo.CmsKit.Localization +@using Volo.CmsKit.Web.Pages.CmsKit.Pages +@using Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Pages +@model IndexModel +@inject IHtmlLocalizer L + +@await Component.InvokeAsync(typeof(DefaultPageViewComponent), + new + { + pageId = Model.Page.Id, + title = Model.Page.Title, + description = Model.Page.Description + }) \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml.cs new file mode 100644 index 0000000000..f0ecfbc9c2 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/Pages/Index.cshtml.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.CmsKit.Pages; + +namespace Volo.CmsKit.Web.Pages.CmsKit.Pages +{ + public class IndexModel : CommonPageModel + { + [BindProperty(SupportsGet = true)] + public string PageUrl { get; set; } + + protected readonly IPageAppService PageAppService; + + public PageDto Page; + + public IndexModel(IPageAppService pageAppService) + { + PageAppService = pageAppService; + } + + public async Task OnGetAsync() + { + Page = await PageAppService.GetByUrlAsync(PageUrl); + } + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/_ViewImports.cshtml b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/_ViewImports.cshtml new file mode 100644 index 0000000000..c1da1f5f10 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CmsKit/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CommonPageModel.cs b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CommonPageModel.cs new file mode 100644 index 0000000000..1148bb0436 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Common.Web/Pages/CommonPageModel.cs @@ -0,0 +1,13 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.CmsKit.Localization; + +namespace Volo.CmsKit.Web.Pages +{ + public abstract class CommonPageModel : AbpPageModel + { + protected CommonPageModel() + { + LocalizationResourceType = typeof(CmsKitResource); + } + } +} \ No newline at end of file From 8845c81a6da9091728ea68d03c01e740918d5b35 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 13:47:57 +0300 Subject: [PATCH 41/53] Created content-test-data --- .../CmsKitDataSeedContributor.cs | 29 +++++++++++++++++-- .../Volo.CmsKit.TestBase/CmsKitTestData.cs | 12 ++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index 2237ecc064..088056dc05 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -5,6 +5,7 @@ using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.Users; using Volo.CmsKit.Comments; +using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; using Volo.CmsKit.Users; @@ -20,7 +21,7 @@ namespace Volo.CmsKit private readonly ReactionManager _reactionManager; private readonly IRatingRepository _ratingRepository; private readonly ICurrentTenant _currentTenant; - + private readonly IContentRepository _contentRepository; public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, ICmsUserRepository cmsUserRepository, @@ -28,7 +29,8 @@ namespace Volo.CmsKit ICommentRepository commentRepository, ReactionManager reactionManager, IRatingRepository ratingRepository, - ICurrentTenant currentTenant) + ICurrentTenant currentTenant, + IContentRepository contentRepository) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -37,6 +39,7 @@ namespace Volo.CmsKit _reactionManager = reactionManager; _ratingRepository = ratingRepository; _currentTenant = currentTenant; + _contentRepository = contentRepository; } public async Task SeedAsync(DataSeedContext context) @@ -50,6 +53,8 @@ namespace Volo.CmsKit await SeedReactionsAsync(); await SeedRatingsAsync(); + + await SeedContentsAsync(); } } @@ -177,5 +182,25 @@ namespace Volo.CmsKit _cmsKitTestData.User2Id )); } + + private async Task SeedContentsAsync() + { + var content1 = new Content( + _guidGenerator.Create(), + _cmsKitTestData.Content_1_EntityType, + _cmsKitTestData.Content_1_Id, + _cmsKitTestData.Content_1 + ); + + var content2 = new Content( + _guidGenerator.Create(), + _cmsKitTestData.Content_2_EntityType, + _cmsKitTestData.Content_2_Id, + _cmsKitTestData.Content_2 + ); + + await _contentRepository.InsertAsync(content1); + await _contentRepository.InsertAsync(content2); + } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 4e1472a3d8..0477711cd3 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -18,5 +18,17 @@ namespace Volo.CmsKit public string EntityId1 { get; } = "1"; public string EntityId2 { get; } = "2"; + + public string Content_1_EntityType = "Lyrics"; + + public string Content_1 { get; } = "First things first\nI'ma say all the words inside my head\nI'm fired up and tired of the way that things have been, oh-ooh\nThe way that things have been, oh-ooh"; + + public string Content_1_Id = "1"; + + public string Content_2_EntityType = "LyricsAlso"; + + public string Content_2 { get; } = "Second thing second\nDon't you tell me what you think that I could be\nI'm the one at the sail, I'm the master of my sea, oh-ooh\nThe master of my sea, oh-ooh"; + + public string Content_2_Id = "2"; } } From 055a7a91c863213250f6d6d5ab4988105002196f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 15:12:29 +0300 Subject: [PATCH 42/53] Added content repository tests --- .../Contents/ContentRepository_Test.cs | 9 +++ .../Contents/ContentRepository_Test.cs | 11 ++++ .../Contents/ContentRepository_Tests.cs | 64 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs 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 new file mode 100644 index 0000000000..72f0b47485 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Contents/ContentRepository_Test.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000000..bb467a4844 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Contents/ContentRepository_Test.cs @@ -0,0 +1,11 @@ +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/Contents/ContentRepository_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs new file mode 100644 index 0000000000..6cec5786e2 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs @@ -0,0 +1,64 @@ +using System; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Modularity; +using Volo.Abp.Uow; +using Xunit; + +namespace Volo.CmsKit.Contents +{ + public abstract class ContentRepository_Tests : CmsKitTestBase + where TStartupModule : IAbpModule + { + private readonly CmsKitTestData _cmsKitTestData; + private readonly IContentRepository _contentRepository; + + public 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_Id); + + 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 dfe9ea40dd398dea89098005dc5c5248f5590f5f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 15:24:40 +0300 Subject: [PATCH 43/53] added id parameter to tag constructor --- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs | 1 + .../cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs | 3 ++- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs index 18fea113c0..943fd6af00 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs @@ -10,6 +10,7 @@ namespace Volo.CmsKit.Tags public interface ITagManager : IDomainService { Task InsertAsync( + Guid id, [NotNull] string entityType, [NotNull] string name, Guid? tenantId = null, diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index 9920fa5a3e..09d9fe6c3c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -19,9 +19,10 @@ namespace Volo.CmsKit.Tags } public Tag( + Guid id, [NotNull] string entityType, [NotNull] string name, - Guid? tenantId = null) + Guid? tenantId = null) : base(id) { EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength); SetName(name); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs index f669298441..bc450ebf7b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -26,13 +26,14 @@ namespace Volo.CmsKit.Tags if (entity == null) { - entity = await InsertAsync(entityType, name, tenantId, cancellationToken); + entity = await InsertAsync(GuidGenerator.Create(), entityType, name, tenantId, cancellationToken); } return entity; } public async Task InsertAsync( + Guid id, [NotNull] string entityType, [NotNull] string name, Guid? tenantId = null, @@ -45,6 +46,7 @@ namespace Volo.CmsKit.Tags return await _tagRepository.InsertAsync( new Tag( + id, entityType, name, tenantId), From c84aaf1e7b84eba75e25a34816551c4e3d7ec90e Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 15:41:24 +0300 Subject: [PATCH 44/53] created tag test data and fix some bugs --- .../Volo/CmsKit/Contents/Content.cs | 2 +- .../Volo/CmsKit/Pages/Page.cs | 2 +- .../Volo/CmsKit/Tags/EntityTag.cs | 2 +- .../Volo/CmsKit/Tags/Tag.cs | 2 +- .../Tags/TagRepository_Test.cs | 9 ++++++ .../MongoDB/Tags/TagRepository_Test.cs | 11 +++++++ .../CmsKitDataSeedContributor.cs | 32 +++++++++++++++++-- .../Volo.CmsKit.TestBase/CmsKitTestData.cs | 5 +++ .../Contents/ContentRepository_Tests.cs | 3 +- .../Tags/TagRepository_Test.cs | 17 ++++++++++ 10 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Tags/TagRepository_Test.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Tags/TagRepository_Test.cs create mode 100644 modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs 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 index 354041b51b..6f4175daad 100644 --- 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 @@ -8,7 +8,7 @@ namespace Volo.CmsKit.Contents { public class Content : FullAuditedAggregateRoot, IMultiTenant { - public virtual Guid? TenantId { get; } + public virtual Guid? TenantId { get; set; } public virtual string EntityType { get; set; } 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 c02617c8d3..16ec7df3a5 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,7 +8,7 @@ namespace Volo.CmsKit.Pages { public class Page : FullAuditedAggregateRoot, IMultiTenant { - public Guid? TenantId { get; } + public Guid? TenantId { get; set; } public virtual string Title { get; set; } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs index e69dbf53aa..5d27e8b15f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/EntityTag.cs @@ -10,7 +10,7 @@ namespace Volo.CmsKit.Tags public virtual string EntityId { get; set; } - public virtual Guid? TenantId { get; } + public virtual Guid? TenantId { get; set; } protected EntityTag() { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs index 09d9fe6c3c..fab09ed521 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs @@ -12,7 +12,7 @@ namespace Volo.CmsKit.Tags public string Name { get; protected set; } - public Guid? TenantId { get; } + public Guid? TenantId { get; set; } protected Tag() { diff --git a/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Tags/TagRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Tags/TagRepository_Test.cs new file mode 100644 index 0000000000..205379e2b3 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.EntityFrameworkCore.Tests/EntityFrameworkCore/Tags/TagRepository_Test.cs @@ -0,0 +1,9 @@ +using Volo.CmsKit.Tags; + +namespace Volo.CmsKit.EntityFrameworkCore.Tags +{ + public class TagRepository_Test : TagRepository_Test + { + + } +} \ No newline at end of file diff --git a/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Tags/TagRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Tags/TagRepository_Test.cs new file mode 100644 index 0000000000..1c2f063989 --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.MongoDB.Tests/MongoDB/Tags/TagRepository_Test.cs @@ -0,0 +1,11 @@ +using Volo.CmsKit.Tags; +using Xunit; + +namespace Volo.CmsKit.MongoDB.Tags +{ + [Collection(MongoTestCollection.Name)] + public class TagRepository_Test : TagRepository_Test + { + + } +} \ 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 088056dc05..a33253406e 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Linq; +using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; @@ -8,6 +9,7 @@ using Volo.CmsKit.Comments; using Volo.CmsKit.Contents; using Volo.CmsKit.Ratings; using Volo.CmsKit.Reactions; +using Volo.CmsKit.Tags; using Volo.CmsKit.Users; namespace Volo.CmsKit @@ -22,6 +24,8 @@ namespace Volo.CmsKit private readonly IRatingRepository _ratingRepository; private readonly ICurrentTenant _currentTenant; private readonly IContentRepository _contentRepository; + private readonly ITagRepository _tagRepository; + public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, ICmsUserRepository cmsUserRepository, @@ -30,7 +34,8 @@ namespace Volo.CmsKit ReactionManager reactionManager, IRatingRepository ratingRepository, ICurrentTenant currentTenant, - IContentRepository contentRepository) + IContentRepository contentRepository, + ITagRepository tagRepository) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -40,6 +45,7 @@ namespace Volo.CmsKit _ratingRepository = ratingRepository; _currentTenant = currentTenant; _contentRepository = contentRepository; + _tagRepository = tagRepository; } public async Task SeedAsync(DataSeedContext context) @@ -55,6 +61,8 @@ namespace Volo.CmsKit await SeedRatingsAsync(); await SeedContentsAsync(); + + await SeedTagsAsync(); } } @@ -202,5 +210,25 @@ namespace Volo.CmsKit await _contentRepository.InsertAsync(content1); await _contentRepository.InsertAsync(content2); } + + private async Task SeedTagsAsync() + { + var content_1_tags = + _cmsKitTestData.Content_1_Tags + .Select(x => + new Tag(_guidGenerator.Create(), _cmsKitTestData.Content_1_EntityType, x)).ToList(); + + var content_2_tags = + _cmsKitTestData.Content_2_Tags + .Select(x => + new Tag(_guidGenerator.Create(), _cmsKitTestData.Content_2_EntityType, x)).ToList(); + + content_1_tags.AddRange(content_2_tags); + + foreach (var tag in content_1_tags) + { + await _tagRepository.InsertAsync(tag); + } + } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs index 0477711cd3..6589e79d9c 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitTestData.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using Volo.Abp.DependencyInjection; namespace Volo.CmsKit @@ -24,11 +25,15 @@ namespace Volo.CmsKit public string Content_1 { get; } = "First things first\nI'ma say all the words inside my head\nI'm fired up and tired of the way that things have been, oh-ooh\nThe way that things have been, oh-ooh"; public string Content_1_Id = "1"; + + public string[] Content_1_Tags => new string[] {"Imagine Dragons", "Music"}; public string Content_2_EntityType = "LyricsAlso"; public string Content_2 { get; } = "Second thing second\nDon't you tell me what you think that I could be\nI'm the one at the sail, I'm the master of my sea, oh-ooh\nThe master of my sea, oh-ooh"; public string Content_2_Id = "2"; + + public string[] Content_2_Tags => new string[] {"Imagine Dragons", "Music", "Most Loved Part"}; } } 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 index 6cec5786e2..c92383694e 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Contents/ContentRepository_Tests.cs @@ -3,7 +3,6 @@ using System.Threading.Tasks; using Shouldly; using Volo.Abp.Domain.Entities; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Xunit; namespace Volo.CmsKit.Contents @@ -14,7 +13,7 @@ namespace Volo.CmsKit.Contents private readonly CmsKitTestData _cmsKitTestData; private readonly IContentRepository _contentRepository; - public ContentRepository_Tests() + protected ContentRepository_Tests() { _cmsKitTestData = GetRequiredService(); _contentRepository = GetRequiredService(); diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs new file mode 100644 index 0000000000..2843c864ef --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs @@ -0,0 +1,17 @@ +using Volo.Abp.Modularity; + +namespace Volo.CmsKit.Tags +{ + public abstract class TagRepository_Test : CmsKitTestBase + where TStartupModule : IAbpModule + { + private readonly CmsKitTestData _cmsKitTestData; + private readonly ITagRepository _tagRepository; + + protected TagRepository_Test() + { + _cmsKitTestData = GetRequiredService(); + _tagRepository = GetRequiredService(); + } + } +} \ No newline at end of file From 4e355428899fbd8abc7658f0eeba71225877336d Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 15:49:51 +0300 Subject: [PATCH 45/53] fix TagRepository --- .../Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs | 2 +- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 6 +++--- .../Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs index c33c577422..b6de5631d4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -12,7 +12,7 @@ namespace Volo.CmsKit.Tags Task GetAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default); Task AnyAsync( diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 5bbecd3629..da5eb4bb2a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -22,7 +22,7 @@ namespace Volo.CmsKit.Tags public virtual Task AnyAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return DbSet.AnyAsync(x => @@ -35,7 +35,7 @@ namespace Volo.CmsKit.Tags public virtual Task GetAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return GetAsync(x => @@ -48,7 +48,7 @@ namespace Volo.CmsKit.Tags public virtual Task FindAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return FindAsync(x => diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 555dad444e..6844c9a064 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -20,7 +20,7 @@ namespace Volo.CmsKit.MongoDB.Tags public Task AnyAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return GetMongoQueryable() @@ -34,7 +34,7 @@ namespace Volo.CmsKit.MongoDB.Tags public Task GetAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return GetAsync(x => @@ -47,7 +47,7 @@ namespace Volo.CmsKit.MongoDB.Tags public Task FindAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default) { return FindAsync(x => From 7dc1bdbe137220a71cc72674a5a5b2b077309894 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 15:59:00 +0300 Subject: [PATCH 46/53] Update ITagRepository.cs --- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs index b6de5631d4..8493fe8401 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagRepository.cs @@ -24,7 +24,7 @@ namespace Volo.CmsKit.Tags Task FindAsync( [NotNull] string entityType, [NotNull] string name, - Guid? tenantId, + Guid? tenantId = null, CancellationToken cancellationToken = default); Task> GetAllRelatedTagsAsync( From 6cc5cd4bd9b7dc200d47e3b5ffa9f0e57948c92f Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 16:21:25 +0300 Subject: [PATCH 47/53] Added Tag tests --- .../CmsKitDataSeedContributor.cs | 36 +++--- .../Tags/TagRepository_Test.cs | 103 +++++++++++++++++- 2 files changed, 119 insertions(+), 20 deletions(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs index a33253406e..8a1ab616d1 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/CmsKitDataSeedContributor.cs @@ -24,8 +24,9 @@ namespace Volo.CmsKit private readonly IRatingRepository _ratingRepository; private readonly ICurrentTenant _currentTenant; private readonly IContentRepository _contentRepository; - private readonly ITagRepository _tagRepository; - + private readonly IEntityTagRepository _entityTagRepository; + private readonly ITagManager _tagManager; + public CmsKitDataSeedContributor( IGuidGenerator guidGenerator, ICmsUserRepository cmsUserRepository, @@ -34,8 +35,9 @@ namespace Volo.CmsKit ReactionManager reactionManager, IRatingRepository ratingRepository, ICurrentTenant currentTenant, - IContentRepository contentRepository, - ITagRepository tagRepository) + IContentRepository contentRepository, + ITagManager tagManager, + IEntityTagRepository entityTagRepository) { _guidGenerator = guidGenerator; _cmsUserRepository = cmsUserRepository; @@ -45,7 +47,8 @@ namespace Volo.CmsKit _ratingRepository = ratingRepository; _currentTenant = currentTenant; _contentRepository = contentRepository; - _tagRepository = tagRepository; + _tagManager = tagManager; + _entityTagRepository = entityTagRepository; } public async Task SeedAsync(DataSeedContext context) @@ -213,21 +216,18 @@ namespace Volo.CmsKit private async Task SeedTagsAsync() { - var content_1_tags = - _cmsKitTestData.Content_1_Tags - .Select(x => - new Tag(_guidGenerator.Create(), _cmsKitTestData.Content_1_EntityType, x)).ToList(); - - var content_2_tags = - _cmsKitTestData.Content_2_Tags - .Select(x => - new Tag(_guidGenerator.Create(), _cmsKitTestData.Content_2_EntityType, x)).ToList(); - - content_1_tags.AddRange(content_2_tags); + foreach (var tag in _cmsKitTestData.Content_1_Tags) + { + var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_1_EntityType, tag); - foreach (var tag in content_1_tags) + await _entityTagRepository.InsertAsync(new EntityTag(tagEntity.Id, _cmsKitTestData.Content_1_Id)); + } + + foreach (var tag in _cmsKitTestData.Content_2_Tags) { - await _tagRepository.InsertAsync(tag); + var tagEntity = await _tagManager.InsertAsync(_guidGenerator.Create(), _cmsKitTestData.Content_2_EntityType, tag); + + await _entityTagRepository.InsertAsync(new EntityTag(tagEntity.Id, _cmsKitTestData.Content_2_Id)); } } } diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs index 2843c864ef..4a7070a20a 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs @@ -1,4 +1,10 @@ -using Volo.Abp.Modularity; +using System; +using System.Linq; +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Modularity; +using Xunit; namespace Volo.CmsKit.Tags { @@ -7,11 +13,104 @@ namespace Volo.CmsKit.Tags { private readonly CmsKitTestData _cmsKitTestData; private readonly ITagRepository _tagRepository; - + protected TagRepository_Test() { _cmsKitTestData = GetRequiredService(); _tagRepository = GetRequiredService(); } + + [Theory] + [InlineData("Lyrics", "Imagine Dragons")] + [InlineData("Lyrics", "Music")] + [InlineData("LyricsAlso", "Imagine Dragons")] + [InlineData("LyricsAlso", "Music")] + [InlineData("LyricsAlso", "Most Loved Part")] + public async Task ShouldGetAsync(string entityType, string name) + { + var tag = await _tagRepository.GetAsync(entityType, name); + + tag.ShouldNotBeNull(); + } + + [Fact] + public async Task ShouldNotGetAsync() + { + Should.Throw( + async () => await _tagRepository.GetAsync("not_exist_entity", Guid.NewGuid().ToString()) + ); + } + + [Theory] + [InlineData("Lyrics", "Imagine Dragons")] + [InlineData("Lyrics", "Music")] + [InlineData("LyricsAlso", "Imagine Dragons")] + [InlineData("LyricsAlso", "Music")] + [InlineData("LyricsAlso", "Most Loved Part")] + public async Task ShouldExistAsync(string entityType, string name) + { + var tag = await _tagRepository.AnyAsync(entityType, name); + + tag.ShouldBeTrue(); + } + + [Fact] + public async Task ShouldNotExistAsync() + { + var tag = await _tagRepository.AnyAsync("not_exist_entity", Guid.NewGuid().ToString()); + + tag.ShouldBeFalse(); + } + + [Theory] + [InlineData("Lyrics", "Imagine Dragons")] + [InlineData("Lyrics", "Music")] + [InlineData("LyricsAlso", "Imagine Dragons")] + [InlineData("LyricsAlso", "Music")] + [InlineData("LyricsAlso", "Most Loved Part")] + public async Task ShouldFindAsync(string entityType, string name) + { + var tag = await _tagRepository.FindAsync(entityType, name); + + tag.ShouldNotBeNull(); + } + + [Fact] + public async Task ShouldNotFindAsync() + { + var tag = await _tagRepository.FindAsync("not_exist_entity", Guid.NewGuid().ToString()); + + tag.ShouldBeNull(); + } + + [Fact] + public async Task Should_Get_Related_Tags() + { + var content_1_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityType); + + content_1_tags.Count.ShouldBe(_cmsKitTestData.Content_1_Tags.Length); + + foreach (var tag in content_1_tags) + { + _cmsKitTestData.Content_1_Tags.Contains(tag.Name).ShouldBeTrue(); + } + + var content_2_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_2_EntityType, _cmsKitTestData.Content_2_EntityType); + + content_2_tags.Count.ShouldBe(_cmsKitTestData.Content_2_Tags.Length); + + foreach (var tag in content_2_tags) + { + _cmsKitTestData.Content_2_Tags.Contains(tag.Name).ShouldBeTrue(); + } + } + + [Fact] + public async Task Should_Not_Get_Related_Tags() + { + var tags = await _tagRepository.GetAllRelatedTagsAsync("not_exist_entity", Guid.NewGuid().ToString()); + + tags.Count.ShouldBe(0); + } } } \ No newline at end of file From d1c4438143001046b1878f4227febdad2e78eac2 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Dec 2020 16:35:21 +0300 Subject: [PATCH 48/53] Update modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs --- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 6f8ae1504b..49240f0d9a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -66,7 +66,7 @@ namespace Volo.CmsKit.Tags { var entityTagIds = await DbContext.Set() .Where(q => q.EntityId == entityId && q.TenantId == tenantId) - .Select(q => q.EntityId) + .Select(q => q.TagId) .ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); var query = DbSet From 3b7657bb0b0629c9c6fd3d7f76e847552bc7f2cf Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 16:40:34 +0300 Subject: [PATCH 49/53] CmsKit - Fix Unsupported mongo query --- .../CmsKit/MongoDB/Tags/MongoTagRepository.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index 6844c9a064..5f57d835f5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Tags; +using Tag = Volo.CmsKit.Tags.Tag; namespace Volo.CmsKit.MongoDB.Tags { @@ -31,7 +32,7 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken); } - public Task GetAsync( + public Task GetAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId = null, @@ -44,7 +45,7 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken: cancellationToken); } - public Task FindAsync( + public Task FindAsync( [NotNull] string entityType, [NotNull] string name, Guid? tenantId = null, @@ -57,7 +58,7 @@ namespace Volo.CmsKit.MongoDB.Tags cancellationToken: cancellationToken); } - public virtual async Task> GetAllRelatedTagsAsync( + public virtual async Task> GetAllRelatedTagsAsync( [NotNull] string entityType, [NotNull] string entityId, Guid? tenantId = null, @@ -65,13 +66,15 @@ namespace Volo.CmsKit.MongoDB.Tags { var entityTagIds = await DbContext.EntityTags.AsQueryable() .Where(q => q.EntityId == entityId && q.TenantId == tenantId) - .Select(q => q.EntityId) + .Select(q => q.TagId) .ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); - var query = GetMongoQueryable() - .Where(x => x.EntityType == entityType && - x.TenantId == tenantId && - entityTagIds.Contains(x.Id.ToString())); + var query = await Collection.FindAsync(Builders.Filter.And(new[] + { + Builders.Filter.Eq(x =>x.EntityType, entityType), + Builders.Filter.Eq(x =>x.TenantId, tenantId), + Builders.Filter.In(x => x.Id, entityTagIds), + })); var result = await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); return result; From 3f76c8d2d21d9baa16bc35f47c23ad25a8a570ed Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 16:41:56 +0300 Subject: [PATCH 50/53] Update TagManager.cs --- .../src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs index bc450ebf7b..2dc1f0b28c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs @@ -59,14 +59,14 @@ namespace Volo.CmsKit.Tags CancellationToken cancellationToken = default) { var entity = await _tagRepository.GetAsync(id, cancellationToken: cancellationToken); - - entity.SetName(name); - - if (await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken)) + + if (name != entity.Name && await _tagRepository.AnyAsync(entity.EntityType, name, entity.TenantId, cancellationToken)) { throw new BusinessException(message: "Tag already exist!"); // Already Exist } + entity.SetName(name); + return await _tagRepository.UpdateAsync(entity); } } From 68f9c3f7ca5fc2a5454ddae053ab38a89281f8e3 Mon Sep 17 00:00:00 2001 From: Ahmet Date: Mon, 28 Dec 2020 16:42:01 +0300 Subject: [PATCH 51/53] Create TagManager_Tests.cs --- .../Tags/TagManager_Tests.cs | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs diff --git a/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs new file mode 100644 index 0000000000..aa31b015cc --- /dev/null +++ b/modules/cms-kit/test/Volo.CmsKit.Domain.Tests/Tags/TagManager_Tests.cs @@ -0,0 +1,104 @@ +using System; +using System.Threading.Tasks; +using Shouldly; +using Xunit; + +namespace Volo.CmsKit.Tags +{ + public class TagManager_Tests : CmsKitDomainTestBase + { + private readonly CmsKitTestData _cmsKitTestData; + private readonly TagManager _tagManager; + + private readonly ITagRepository _tagRepository; + + public TagManager_Tests() + { + _cmsKitTestData = GetRequiredService(); + _tagManager = GetRequiredService(); + _tagRepository = GetRequiredService(); + } + + [Fact] + public async Task ShouldAddWhenGettingAsync() + { + var newTagEntityType = "testEntity"; + var newTagName = "test_tag_2123"; + + var doesExist = await _tagRepository.AnyAsync(newTagEntityType, newTagName); + + doesExist.ShouldBeFalse(); + + var newTag = await _tagManager.GetOrAddAsync(newTagEntityType, newTagName); + + newTag.ShouldNotBeNull(); + + var doesExistAgain = await _tagRepository.AnyAsync(newTagEntityType, newTagName); + + doesExistAgain.ShouldBeTrue(); + } + + [Fact] + public async Task ShouldNotAddWhenGettingAsync() + { + var tagName = _cmsKitTestData.Content_1_Tags[0]; + + var tag = await _tagRepository.GetAsync(_cmsKitTestData.Content_1_EntityType, tagName); + + var newTag = await _tagManager.GetOrAddAsync(_cmsKitTestData.Content_1_EntityType, tag.Name); + + newTag.ShouldNotBeNull(); + + newTag.Id.ShouldBe(tag.Id); + } + + [Fact] + public async Task ShouldInsert() + { + var tag = await _tagManager.InsertAsync(Guid.NewGuid(), "test", "test"); + + tag.ShouldNotBeNull(); + + var doesExist = await _tagRepository.AnyAsync("test", "test"); + + doesExist.ShouldBeTrue(); + } + + [Fact] + public async Task ShouldNotInsert() + { + var type = _cmsKitTestData.Content_1_EntityType; + var name = _cmsKitTestData.Content_1_Tags[0]; + + Should.Throw(async () => await _tagManager.InsertAsync(Guid.NewGuid(), type, name)); + } + + [Fact] + public async Task ShouldUpdate() + { + var type = _cmsKitTestData.Content_1_EntityType; + var name = _cmsKitTestData.Content_1_Tags[0]; + var newName = name + "-updated"; + + var tag = await _tagRepository.GetAsync(type, name); + + await _tagManager.UpdateAsync(tag.Id, newName); + + var updatedTag = await _tagRepository.GetAsync(type, newName); + + updatedTag.Id.ShouldBe(tag.Id); + } + + [Fact] + public async Task ShouldNotUpdate() + { + var type = _cmsKitTestData.Content_1_EntityType; + var name = _cmsKitTestData.Content_1_Tags[0]; + var newName = _cmsKitTestData.Content_1_Tags[1]; + + var tag = await _tagRepository.GetAsync(type, name); + + Should.Throw(async () => await _tagManager.UpdateAsync(tag.Id, newName)); + } + } +} \ No newline at end of file From 2fa7fd24b913f396e78eaa5c8e02a3cf4b0bf543 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 17:21:14 +0300 Subject: [PATCH 52/53] Update EfCoreTagRepository.cs --- .../Volo/CmsKit/Tags/EfCoreTagRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 49240f0d9a..593905cc95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -72,7 +72,7 @@ namespace Volo.CmsKit.Tags var query = DbSet .Where(x => x.EntityType == entityType && x.TenantId == tenantId && - entityTagIds.Contains(x.Id.ToString())); + entityTagIds.Contains(x.Id)); return await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); } From f192860fa34fb96f944f3d4939b895a23bd45524 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 28 Dec 2020 17:25:53 +0300 Subject: [PATCH 53/53] Fix mismatching parameter in TagRepository_Test --- .../test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs index 4a7070a20a..18cc12df68 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Tags/TagRepository_Test.cs @@ -86,7 +86,7 @@ namespace Volo.CmsKit.Tags [Fact] public async Task Should_Get_Related_Tags() { - var content_1_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_1_EntityType, _cmsKitTestData.Content_1_EntityType); + var content_1_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_1_EntityType, _cmsKitTestData.EntityId1); content_1_tags.Count.ShouldBe(_cmsKitTestData.Content_1_Tags.Length); @@ -95,7 +95,7 @@ namespace Volo.CmsKit.Tags _cmsKitTestData.Content_1_Tags.Contains(tag.Name).ShouldBeTrue(); } - var content_2_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_2_EntityType, _cmsKitTestData.Content_2_EntityType); + var content_2_tags = await _tagRepository.GetAllRelatedTagsAsync(_cmsKitTestData.Content_2_EntityType, _cmsKitTestData.EntityId2); content_2_tags.Count.ShouldBe(_cmsKitTestData.Content_2_Tags.Length);