From 86d89ebba52b99927f37ef9a592ed01d2b80d8e5 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:44:44 +0100 Subject: [PATCH 01/26] Allow the exchange type to be specified --- .../RabbitMq/AbpRabbitMqEventBusOptions.cs | 20 ++++++++++++++++++- .../RabbitMq/RabbitMqDistributedEventBus.cs | 2 +- .../Volo/Abp/RabbitMQ/RabbitMqConsts.cs | 11 ++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs index ad09223f05..dd451d2127 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs @@ -1,10 +1,28 @@ -namespace Volo.Abp.EventBus.RabbitMq; +using Volo.Abp.RabbitMQ; + +namespace Volo.Abp.EventBus.RabbitMq; public class AbpRabbitMqEventBusOptions { + public const string DefaultExchangeType = RabbitMqConsts.ExchangeTypes.Direct; + public string ConnectionName { get; set; } public string ClientName { get; set; } public string ExchangeName { get; set; } + + public string ExchangeType { get; set; } + + public AbpRabbitMqEventBusOptions() + { + ExchangeType = "direct"; + } + + public string GetExchangeTypeOrDefault() + { + return string.IsNullOrEmpty(ExchangeType) + ? DefaultExchangeType + : ExchangeType; + } } diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index c57d9e9417..38070ae7ce 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -69,7 +69,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe Consumer = MessageConsumerFactory.Create( new ExchangeDeclareConfiguration( AbpRabbitMqEventBusOptions.ExchangeName, - type: "direct", + type: AbpRabbitMqEventBusOptions.ExchangeType, durable: true ), new QueueDeclareConfiguration( diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs index 19b8ddb573..996e88959b 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqConsts.cs @@ -8,4 +8,15 @@ public static class RabbitMqConsts public const int Persistent = 2; } + + public static class ExchangeTypes + { + public const string Direct = "direct"; + + public const string Topic = "topic"; + + public const string Fanout = "fanout"; + + public const string Headers = "headers"; + } } From 5cfd2fa012817a521b12987ff68eec5ad5a6c5a6 Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:45:53 +0100 Subject: [PATCH 02/26] fix hardcoded reference --- .../Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 38070ae7ce..33663086c4 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe { channel.ExchangeDeclare( AbpRabbitMqEventBusOptions.ExchangeName, - "direct", + AbpRabbitMqEventBusOptions.ExchangeType, durable: true ); From ff9ebdbcabbf0e3806644378a39d127bbccb882f Mon Sep 17 00:00:00 2001 From: Necati Meral Date: Sat, 19 Mar 2022 20:46:56 +0100 Subject: [PATCH 03/26] Update usage of default value --- .../Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs | 5 ----- .../Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs index dd451d2127..addbc49171 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/AbpRabbitMqEventBusOptions.cs @@ -14,11 +14,6 @@ public class AbpRabbitMqEventBusOptions public string ExchangeType { get; set; } - public AbpRabbitMqEventBusOptions() - { - ExchangeType = "direct"; - } - public string GetExchangeTypeOrDefault() { return string.IsNullOrEmpty(ExchangeType) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 33663086c4..a2932de52e 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -69,7 +69,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe Consumer = MessageConsumerFactory.Create( new ExchangeDeclareConfiguration( AbpRabbitMqEventBusOptions.ExchangeName, - type: AbpRabbitMqEventBusOptions.ExchangeType, + type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ), new QueueDeclareConfiguration( @@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe { channel.ExchangeDeclare( AbpRabbitMqEventBusOptions.ExchangeName, - AbpRabbitMqEventBusOptions.ExchangeType, + AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ); From 9082870eec79dfb271561e3ab6721f61e32f003a Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Mon, 21 Mar 2022 00:01:25 +0300 Subject: [PATCH 04/26] add filter by user --- .../Volo/CmsKit/Admin/Blogs/BlogPostGetListInput.cs | 2 ++ .../CmsKit/Admin/Blogs/BlogPostAdminAppService.cs | 3 ++- .../Volo/CmsKit/Blogs/IBlogPostRepository.cs | 3 ++- .../Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs | 4 +++- .../CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs | 4 +++- .../Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs | 11 +++++++++++ .../CmsKit/Public/Blogs/IBlogPostPublicAppService.cs | 2 +- .../CmsKit/Public/Blogs/BlogPostPublicAppService.cs | 7 ++++--- .../CmsKit/Public/Blogs/BlogPostPublicController.cs | 5 ++--- .../Pages/Public/CmsKit/Blogs/Index.cshtml.cs | 3 +-- 10 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostGetListInput.cs index e8fa497e15..3b2d4c2c93 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostGetListInput.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application.Contracts/Volo/CmsKit/Admin/Blogs/BlogPostGetListInput.cs @@ -8,4 +8,6 @@ public class BlogPostGetListInput : PagedAndSortedResultRequestDto public string Filter { get; set; } public Guid? BlogId { get; set; } + + public Guid? AuthorId { get; set; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index 83899199f0..fbea1d81c7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -89,7 +89,8 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe { var blogs = (await BlogRepository.GetListAsync()).ToDictionary(x => x.Id); - var blogPosts = await BlogPostRepository.GetListAsync(input.Filter, input.BlogId, input.MaxResultCount, input.SkipCount, input.Sorting); + var blogPosts = await BlogPostRepository.GetListAsync(input.Filter, input.BlogId, input.AuthorId, + input.MaxResultCount, input.SkipCount, input.Sorting); var count = await BlogPostRepository.GetCountAsync(input.Filter); diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index 8b1e86f8b7..5b04ffee07 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs @@ -16,6 +16,7 @@ public interface IBlogPostRepository : IBasicRepository Task> GetListAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -24,4 +25,4 @@ public interface IBlogPostRepository : IBasicRepository Task SlugExistsAsync(Guid blogId, string slug, CancellationToken cancellationToken = default); Task GetBySlugAsync(Guid blogId, string slug, CancellationToken cancellationToken = default); -} +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index f0a6aa61ee..64fe2e2e02 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -54,6 +54,7 @@ public class EfCoreBlogPostRepository : EfCoreRepository> GetListAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -66,7 +67,8 @@ public class EfCoreBlogPostRepository : EfCoreRepository x.BlogId == blogId) - .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)); + .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)) + .WhereIf(authorId.HasValue, x => x.AuthorId == authorId); queryable = queryable.OrderBy(sorting.IsNullOrEmpty() ? $"{nameof(BlogPost.CreationTime)} desc" : sorting); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index f52dc3add4..adf394b90f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -55,6 +55,7 @@ public class MongoBlogPostRepository : MongoDbRepository> GetListAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -68,7 +69,8 @@ public class MongoBlogPostRepository : MongoDbRepository x.BlogId == blogId) - .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)); + .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)) + .WhereIf(authorId.HasValue, x => x.AuthorId == authorId); queryable = queryable.OrderBy(sorting.IsNullOrEmpty() ? $"{nameof(BlogPost.CreationTime)} desc" : sorting); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs new file mode 100644 index 0000000000..82388fdb42 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs @@ -0,0 +1,11 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Public.Blogs; + +public class BlogPostGetListInput : PagedAndSortedResultRequestDto +{ + public string BlogSlug { get; set; } + + public Guid? AuthorId { get; set; } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index f561a289cf..89103979ba 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -7,7 +7,7 @@ namespace Volo.CmsKit.Public.Blogs; public interface IBlogPostPublicAppService : IApplicationService { - Task> GetListAsync([NotNull] string blogSlug, PagedAndSortedResultRequestDto input); + Task> GetListAsync(BlogPostGetListInput input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 4160639815..39e5e75128 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -32,11 +32,12 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub return ObjectMapper.Map(blogPost); } - public virtual async Task> GetListAsync([NotNull] string blogSlug, PagedAndSortedResultRequestDto input) + public virtual async Task> GetListAsync(BlogPostGetListInput input) { - var blog = await BlogRepository.GetBySlugAsync(blogSlug); + var blog = await BlogRepository.GetBySlugAsync(input.BlogSlug); - var blogPosts = await BlogPostRepository.GetListAsync(null, blog.Id, input.MaxResultCount, input.SkipCount, input.Sorting); + var blogPosts = await BlogPostRepository.GetListAsync(null, blog.Id, input.AuthorId, input.MaxResultCount, + input.SkipCount, input.Sorting); return new PagedResultDto( await BlogPostRepository.GetCountAsync(blogId: blog.Id), diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index bdd0b2cf32..b89939627f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -30,9 +30,8 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub } [HttpGet] - [Route("{blogSlug}")] - public virtual Task> GetListAsync(string blogSlug, PagedAndSortedResultRequestDto input) + public virtual Task> GetListAsync(BlogPostGetListInput input) { - return BlogPostPublicAppService.GetListAsync(blogSlug, input); + return BlogPostPublicAppService.GetListAsync(input); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index 30d4c6bcf2..b93a5d5f40 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -34,8 +34,7 @@ public class IndexModel : CmsKitPublicPageModelBase public async Task OnGetAsync() { Blogs = await BlogPostPublicAppService.GetListAsync( - BlogSlug, - new PagedAndSortedResultRequestDto + new BlogPostGetListInput { SkipCount = PageSize * (CurrentPage - 1), MaxResultCount = PageSize From 59fed8a9ddb2b7fb2f6afb87aac04a740c3f9f69 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Tue, 22 Mar 2022 15:51:28 +0300 Subject: [PATCH 05/26] Update en.json --- .../Commercial/Localization/Resources/en.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 8fa96b5ee2..8aa62afbb4 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -495,7 +495,9 @@ "LicenseTypeNotCorrect": "The license type is not correct!", "Trainings": "Trainings", "ChoseTrainingPlaceholder": "Chose the training...", - "ContactUsToGetQuote": "Contact us to get a quote", + "DoYouNeedTrainings": "Do you need one of these trainings?", + "DoYouNeedTraining": "Do you need {0} training?", + "GetInTouchUs": "Get in touch with us", "ForMoreInformationClickHere": "For more information, click here.", "IsGetOnboardingTraining": "Would you like to get onboarding & web application development training?", "OnboardingWebApplicationDevelopmentTrainingMessage": "To schedule your training calendar, please contact {0} after creating the organization", From cf226dca5297bb6f89891c5aeead11c6336dee32 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Tue, 22 Mar 2022 16:03:56 +0300 Subject: [PATCH 06/26] filter by user completed --- .../Volo/CmsKit/Blogs/IBlogPostRepository.cs | 3 ++ .../CmsKit/Blogs/EfCoreBlogPostRepository.cs | 6 +++ .../MongoDB/Blogs/MongoBlogPostRepository.cs | 6 +++ .../Public/Blogs/BlogPostGetListInput.cs | 2 - .../Public/Blogs/IBlogPostPublicAppService.cs | 8 +++- .../Public/Blogs/BlogPostPublicAppService.cs | 12 +++++- .../Public/Blogs/BlogPostPublicController.cs | 15 +++++-- .../Pages/Public/CmsKit/Blogs/BlogPost.cshtml | 4 +- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 39 ++++++++++++++++--- .../Pages/Public/CmsKit/Blogs/Index.cshtml.cs | 13 ++++++- .../Pages/Public/CmsKit/Blogs/index.css | 4 ++ .../Pages/Public/CmsKit/Blogs/index.js | 18 +++++++++ 12 files changed, 113 insertions(+), 17 deletions(-) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.js diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index 5b04ffee07..6e650113d3 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; +using Volo.CmsKit.Users; namespace Volo.CmsKit.Blogs; @@ -25,4 +26,6 @@ public interface IBlogPostRepository : IBasicRepository Task SlugExistsAsync(Guid blogId, string slug, CancellationToken cancellationToken = default); Task GetBySlugAsync(Guid blogId, string slug, CancellationToken cancellationToken = default); + + Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index 64fe2e2e02..cbd8fa3cfe 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -97,4 +97,10 @@ public class EfCoreBlogPostRepository : EfCoreRepository x.BlogId == blogId && x.Slug.ToLower() == slug, GetCancellationToken(cancellationToken)); } + + public async Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) + { + return await (await GetDbContextAsync()).BlogPosts.Select(x => x.Author).Distinct() + .ToListAsync(GetCancellationToken(cancellationToken)); + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index adf394b90f..a2bae9e317 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -101,4 +101,10 @@ public class MongoBlogPostRepository : MongoDbRepository x.BlogId == blogId && x.Slug.ToLower() == slug, token); } + + public async Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) + { + var queryable = (await GetQueryableAsync()).Select(x => x.Author).Distinct(); + return await AsyncExecuter.ToListAsync(queryable, GetCancellationToken(cancellationToken)); + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs index 82388fdb42..b471171f3b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs @@ -5,7 +5,5 @@ namespace Volo.CmsKit.Public.Blogs; public class BlogPostGetListInput : PagedAndSortedResultRequestDto { - public string BlogSlug { get; set; } - public Guid? AuthorId { get; set; } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index 89103979ba..7f2b50c2a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -1,13 +1,17 @@ -using JetBrains.Annotations; +using System.Collections.Generic; +using JetBrains.Annotations; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.CmsKit.Users; namespace Volo.CmsKit.Public.Blogs; public interface IBlogPostPublicAppService : IApplicationService { - Task> GetListAsync(BlogPostGetListInput input); + Task> GetListAsync(string blogSlug, BlogPostGetListInput input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); + + Task> GetAuthorsHasBlogPosts(); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 39e5e75128..12543b0ed4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -5,6 +5,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.Blogs; using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Users; namespace Volo.CmsKit.Public.Blogs; @@ -14,6 +15,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub protected IBlogRepository BlogRepository { get; } protected IBlogPostRepository BlogPostRepository { get; } + public BlogPostPublicAppService( IBlogRepository blogRepository, @@ -32,9 +34,9 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub return ObjectMapper.Map(blogPost); } - public virtual async Task> GetListAsync(BlogPostGetListInput input) + public virtual async Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { - var blog = await BlogRepository.GetBySlugAsync(input.BlogSlug); + var blog = await BlogRepository.GetBySlugAsync(blogSlug); var blogPosts = await BlogPostRepository.GetListAsync(null, blog.Id, input.AuthorId, input.MaxResultCount, input.SkipCount, input.Sorting); @@ -43,4 +45,10 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub await BlogPostRepository.GetCountAsync(blogId: blog.Id), ObjectMapper.Map, List>(blogPosts)); } + + public virtual async Task> GetAuthorsHasBlogPosts() + { + var authors = await BlogPostRepository.GetAuthorsHasBlogPosts(); + return ObjectMapper.Map, List>(authors); + } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index b89939627f..6db900c6ad 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -1,11 +1,13 @@ using Microsoft.AspNetCore.Mvc; using System; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Content; using Volo.Abp.GlobalFeatures; using Volo.CmsKit.GlobalFeatures; +using Volo.CmsKit.Users; namespace Volo.CmsKit.Public.Blogs; @@ -30,8 +32,15 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub } [HttpGet] - public virtual Task> GetListAsync(BlogPostGetListInput input) + [Route("{blogSlug}")] + public virtual Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { - return BlogPostPublicAppService.GetListAsync(input); + return BlogPostPublicAppService.GetListAsync(blogSlug, input); } -} + + [HttpGet] + public virtual Task> GetAuthorsHasBlogPosts() + { + return BlogPostPublicAppService.GetAuthorsHasBlogPosts(); + } +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml index d8c1f428da..496ce7f8c5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml @@ -41,7 +41,9 @@

@Model.BlogPost.Title

- @@@Model.BlogPost.Author?.UserName + + @@@Model.BlogPost.Author?.UserName + @Model.BlogPost.CreationTime

diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 32c5585f8e..dbc0d699ef 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -8,12 +8,40 @@ @model IndexModel @section styles{ - + } + +@section scripts { + + + +} + @{ const string dummyImageSource = "https://dummyimage.com/320x180/a3a3a3/fff.png"; } + + +
+ + +
+
+
@foreach (var blog in Model.Blogs.Items) { @@ -21,16 +49,16 @@ @if (blog.CoverImageMediaId != null) { - + } else { - + }
@blog.Title

- @@@blog.Author?.UserName + @@@blog.Author?.UserName @blog.CreationTime

@blog.ShortDescription

@@ -42,11 +70,10 @@
- }
- + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index b93a5d5f40..92c4ff235c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination; using Volo.CmsKit.Public.Blogs; +using Volo.CmsKit.Users; namespace Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs; @@ -19,10 +20,16 @@ public class IndexModel : CmsKitPublicPageModelBase [BindProperty(SupportsGet = true)] public int CurrentPage { get; set; } = 1; + + [BindProperty(SupportsGet = true)] + public Guid? AuthorId { get; set; } public PagedResultDto Blogs { get; private set; } public PagerModel PagerModel => new PagerModel(Blogs.TotalCount, Blogs.Items.Count, CurrentPage, PageSize, Request.Path.ToString()); + + [BindProperty(SupportsGet = true)] + public List Authors { get; set; } protected IBlogPostPublicAppService BlogPostPublicAppService { get; } @@ -34,10 +41,14 @@ public class IndexModel : CmsKitPublicPageModelBase public async Task OnGetAsync() { Blogs = await BlogPostPublicAppService.GetListAsync( + BlogSlug, new BlogPostGetListInput { SkipCount = PageSize * (CurrentPage - 1), - MaxResultCount = PageSize + MaxResultCount = PageSize, + AuthorId = AuthorId }); + + Authors = await BlogPostPublicAppService.GetAuthorsHasBlogPosts(); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.css b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.css index 161bb41190..19137de2cb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.css +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.css @@ -3,4 +3,8 @@ .popover { min-width: 276px; +} + +.author-name-span{ + cursor: pointer; } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.js new file mode 100644 index 0000000000..0d567d1650 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/index.js @@ -0,0 +1,18 @@ +$(function () { + var $selectAuthor = $('#AuthorSelect'); + var $authorNameSpan = $('.author-name-span'); + + $selectAuthor.on('change', function () { + var authorId = $selectAuthor.val(); + reloadPageWithQueryString({'authorId': authorId}); + }); + + $authorNameSpan.click(function () { + var authorId = $(this).data('author-id'); + reloadPageWithQueryString({'authorId': authorId}); + }); + + function reloadPageWithQueryString(param) { + window.location.href = window.location.pathname + "?" + $.param(param); + } +}); From 8fa4afa2601c3510f3406a000b5089fbee91aa7d Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Tue, 22 Mar 2022 16:32:13 +0300 Subject: [PATCH 07/26] Update BlogPostPublicClientProxy.Generated.cs --- .../BlogPostPublicClientProxy.Generated.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs index c96e37f579..62a79cf6a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs @@ -1,5 +1,6 @@ // This file is automatically generated by ABP framework to use MVC Controllers from CSharp using System; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Http.Client; @@ -7,6 +8,7 @@ using Volo.Abp.Http.Modeling; using Volo.Abp.DependencyInjection; using Volo.Abp.Http.Client.ClientProxying; using Volo.CmsKit.Public.Blogs; +using Volo.CmsKit.Users; // ReSharper disable once CheckNamespace namespace Volo.CmsKit.Public.Blogs.ClientProxies; @@ -23,13 +25,18 @@ public partial class BlogPostPublicClientProxy : ClientProxyBase> GetListAsync(string blogSlug, PagedAndSortedResultRequestDto input) + + public virtual async Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { return await RequestAsync>(nameof(GetListAsync), new ClientProxyRequestTypeValue { { typeof(string), blogSlug }, - { typeof(PagedAndSortedResultRequestDto), input } + { typeof(BlogPostGetListInput), input } }); } + + public virtual async Task> GetAuthorsHasBlogPosts() + { + return await RequestAsync>(nameof(GetAuthorsHasBlogPosts)); + } } From 2c9b725554b280bea262941e8a5c8b3bc7210343 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Mar 2022 12:15:17 +0300 Subject: [PATCH 08/26] Fix CmsKit Tests --- .../Blogs/BlogPostPublicAppService_Tests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs index 2301941920..f7a1ad3e7c 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs @@ -26,7 +26,7 @@ public class BlogPostPublicAppService_Tests : CmsKitApplicationTestBase [Fact] public async Task GetListAsync_ShouldWorkProperly_WithExistingBlog() { - var blogPosts = await blogPostAppService.GetListAsync(cmsKitTestData.BlogSlug, new PagedAndSortedResultRequestDto { MaxResultCount = 2 }); + var blogPosts = await blogPostAppService.GetListAsync(cmsKitTestData.BlogSlug, new BlogPostGetListInput { MaxResultCount = 2 }); blogPosts.ShouldNotBeNull(); blogPosts.TotalCount.ShouldBe(2); From fe34681006020edd9a8cbc2a6d36c63be84cf55a Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Mar 2022 12:15:35 +0300 Subject: [PATCH 09/26] Add simple test for GetAuthorsHasBlogPosts --- .../Blogs/BlogPostRepository_Test.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs b/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs index 0479ce75b2..4d696e916d 100644 --- a/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs +++ b/modules/cms-kit/test/Volo.CmsKit.TestBase/Blogs/BlogPostRepository_Test.cs @@ -145,4 +145,14 @@ public abstract class BlogPostRepository_Test : CmsKitTestBase x.Id == testData.User1Id); + } } From df12120c4323c48f909f0ff7ee3ccfb30868b75f Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 23 Mar 2022 12:27:24 +0300 Subject: [PATCH 10/26] Fix MongoDB query for GetAuthorsHasBlogPosts --- .../MongoDB/Blogs/MongoBlogPostRepository.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index a2bae9e317..3b04f46fb6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -104,7 +104,19 @@ public class MongoBlogPostRepository : MongoDbRepository> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) { - var queryable = (await GetQueryableAsync()).Select(x => x.Author).Distinct(); + var blogPostQueryable = (await GetQueryableAsync()); + + var usersQueryable = (await GetDbContextAsync()).Collection().AsQueryable(); + + var queryable = blogPostQueryable + .Join( + usersQueryable, + o => o.AuthorId, + i => i.Id, + (blogPost, user) => new { blogPost, user }) + .Select(s => s.user) + .Distinct(); + return await AsyncExecuter.ToListAsync(queryable, GetCancellationToken(cancellationToken)); } } From a676ab306760fbc2484db971ccbfe7c1d242e27b Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 23 Mar 2022 22:40:20 +0300 Subject: [PATCH 11/26] rename GetAuthorsHasBlogPosts as GetAuthorsHasBlogPostsAsync --- .../Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs | 2 +- .../Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs | 2 +- .../ClientProxies/BlogPostPublicClientProxy.Generated.cs | 4 ++-- .../Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs | 4 ++-- .../Pages/Public/CmsKit/Blogs/Index.cshtml.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index 7f2b50c2a5..d411869bd2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -13,5 +13,5 @@ public interface IBlogPostPublicAppService : IApplicationService Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); - Task> GetAuthorsHasBlogPosts(); + Task> GetAuthorsHasBlogPostsAsync(); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 12543b0ed4..4d2af29f2d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -46,7 +46,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub ObjectMapper.Map, List>(blogPosts)); } - public virtual async Task> GetAuthorsHasBlogPosts() + public virtual async Task> GetAuthorsHasBlogPostsAsync() { var authors = await BlogPostRepository.GetAuthorsHasBlogPosts(); return ObjectMapper.Map, List>(authors); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs index 62a79cf6a5..9cc926515d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/BlogPostPublicClientProxy.Generated.cs @@ -35,8 +35,8 @@ public partial class BlogPostPublicClientProxy : ClientProxyBase> GetAuthorsHasBlogPosts() + public virtual async Task> GetAuthorsHasBlogPostsAsync() { - return await RequestAsync>(nameof(GetAuthorsHasBlogPosts)); + return await RequestAsync>(nameof(GetAuthorsHasBlogPostsAsync)); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index 6db900c6ad..a08ccdfa95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -39,8 +39,8 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub } [HttpGet] - public virtual Task> GetAuthorsHasBlogPosts() + public virtual Task> GetAuthorsHasBlogPostsAsync() { - return BlogPostPublicAppService.GetAuthorsHasBlogPosts(); + return BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs index 92c4ff235c..c9dc49931d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml.cs @@ -49,6 +49,6 @@ public class IndexModel : CmsKitPublicPageModelBase AuthorId = AuthorId }); - Authors = await BlogPostPublicAppService.GetAuthorsHasBlogPosts(); + Authors = await BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); } } From 2e9a25dc0628a55a2af309b28da8d592c5cd2a45 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 23 Mar 2022 22:42:28 +0300 Subject: [PATCH 12/26] add [NotNullAttribute] --- .../Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs | 2 +- .../Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index d411869bd2..02b6d2a5f4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -9,7 +9,7 @@ namespace Volo.CmsKit.Public.Blogs; public interface IBlogPostPublicAppService : IApplicationService { - Task> GetListAsync(string blogSlug, BlogPostGetListInput input); + Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 4d2af29f2d..62a970cf2f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -34,7 +34,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub return ObjectMapper.Map(blogPost); } - public virtual async Task> GetListAsync(string blogSlug, BlogPostGetListInput input) + public virtual async Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input) { var blog = await BlogRepository.GetBySlugAsync(blogSlug); From ae27b07a77f8b6157195f11da9be634687c98439 Mon Sep 17 00:00:00 2001 From: Musa Demir <48536631+demirmusa@users.noreply.github.com> Date: Wed, 23 Mar 2022 22:43:17 +0300 Subject: [PATCH 13/26] Update modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs Co-authored-by: Enis Necipoglu --- .../Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index 6db900c6ad..b3ba981b43 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs @@ -39,6 +39,7 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub } [HttpGet] + [Route("authors") public virtual Task> GetAuthorsHasBlogPosts() { return BlogPostPublicAppService.GetAuthorsHasBlogPosts(); From 0cd4c2bbf546bf8857e3448871079d554513a863 Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 23 Mar 2022 23:14:53 +0300 Subject: [PATCH 14/26] allow filtering by user for GetCountAsync function --- .../Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs | 2 +- .../Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs | 1 + .../Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs | 2 ++ .../Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs | 2 ++ .../Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs | 2 +- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index fbea1d81c7..58ea5b9b83 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -92,7 +92,7 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe var blogPosts = await BlogPostRepository.GetListAsync(input.Filter, input.BlogId, input.AuthorId, input.MaxResultCount, input.SkipCount, input.Sorting); - var count = await BlogPostRepository.GetCountAsync(input.Filter); + var count = await BlogPostRepository.GetCountAsync(input.Filter, input.BlogId, input.AuthorId); var dtoList = blogPosts.Select(x => { diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index 6e650113d3..fed0eed037 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs @@ -12,6 +12,7 @@ public interface IBlogPostRepository : IBasicRepository Task GetCountAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, CancellationToken cancellationToken = default); Task> GetListAsync( diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index cbd8fa3cfe..cfc39a62c7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -41,10 +41,12 @@ public class EfCoreBlogPostRepository : EfCoreRepository GetCountAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, CancellationToken cancellationToken = default) { var queryable = (await GetDbSetAsync()) .WhereIf(blogId.HasValue, x => x.BlogId == blogId) + .WhereIf(authorId.HasValue, x => x.AuthorId == authorId) .WhereIf(!string.IsNullOrEmpty(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)); var count = await queryable.CountAsync(GetCancellationToken(cancellationToken)); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index 3b04f46fb6..5f72246d93 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -42,6 +42,7 @@ public class MongoBlogPostRepository : MongoDbRepository GetCountAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, CancellationToken cancellationToken = default) { var token = GetCancellationToken(cancellationToken); @@ -49,6 +50,7 @@ public class MongoBlogPostRepository : MongoDbRepository>(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)) .WhereIf>(blogId.HasValue, x => x.BlogId == blogId) + .WhereIf>(authorId.HasValue, x => x.AuthorId == authorId) .CountAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 62a970cf2f..a9121a5c2b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -42,7 +42,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub input.SkipCount, input.Sorting); return new PagedResultDto( - await BlogPostRepository.GetCountAsync(blogId: blog.Id), + await BlogPostRepository.GetCountAsync(blogId: blog.Id, authorId: input.AuthorId), ObjectMapper.Map, List>(blogPosts)); } From 859d7ceb218419a2ab5b789e80e3654f260d2b7c Mon Sep 17 00:00:00 2001 From: Musa Demir Date: Wed, 23 Mar 2022 23:15:12 +0300 Subject: [PATCH 15/26] Test user filter --- .../Blogs/BlogPostPublicAppService_Tests.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs index f7a1ad3e7c..64725fc700 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Blogs/BlogPostPublicAppService_Tests.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; using Volo.CmsKit.Public.Blogs; +using Volo.CmsKit.Users; using Xunit; namespace Volo.CmsKit.Blogs; @@ -17,10 +18,20 @@ public class BlogPostPublicAppService_Tests : CmsKitApplicationTestBase private readonly CmsKitTestData cmsKitTestData; + private readonly ICmsUserRepository userRepository; + + private readonly IBlogRepository blogRepository; + private readonly IBlogPostRepository blogPostRepository; + + private readonly BlogPostManager blogPostManager; public BlogPostPublicAppService_Tests() { blogPostAppService = GetRequiredService(); cmsKitTestData = GetRequiredService(); + userRepository = GetRequiredService(); + blogRepository = GetRequiredService(); + blogPostManager = GetRequiredService(); + blogPostRepository = GetRequiredService(); } [Fact] @@ -62,4 +73,49 @@ public class BlogPostPublicAppService_Tests : CmsKitApplicationTestBase exception.EntityType.ShouldBe(typeof(Blog)); } + + [Fact] + public async Task GetListAsync_ShouldFilterByUser() + { + var user2 = await userRepository.GetAsync(cmsKitTestData.User2Id); + var blog = await blogRepository.GetAsync(cmsKitTestData.Blog_Id); + + var blogPost = await blogPostManager.CreateAsync( + user2, + blog, + cmsKitTestData.BlogPost_1_Title + "by user2", + cmsKitTestData.BlogPost_1_Slug + "by user2", + "Short desc 1", + "Blog Post 1 Content" + ); + + await blogPostRepository.InsertAsync(blogPost); + + //should get all not filtered by user + var blogPosts = await blogPostAppService.GetListAsync(cmsKitTestData.BlogSlug, + new BlogPostGetListInput {}); + + blogPosts.ShouldNotBeNull(); + blogPosts.TotalCount.ShouldBe(3); + blogPosts.Items.ShouldNotBeEmpty(); + blogPosts.Items.Count.ShouldBe(3); + + //should get only one filtered by user + blogPosts = await blogPostAppService.GetListAsync(cmsKitTestData.BlogSlug, + new BlogPostGetListInput {AuthorId = user2.Id}); + + blogPosts.ShouldNotBeNull(); + blogPosts.TotalCount.ShouldBe(1); + blogPosts.Items.ShouldNotBeEmpty(); + blogPosts.Items.Count.ShouldBe(1); + + //should get filtered by user1 + blogPosts = await blogPostAppService.GetListAsync(cmsKitTestData.BlogSlug, + new BlogPostGetListInput {AuthorId = cmsKitTestData.User1Id}); + + blogPosts.ShouldNotBeNull(); + blogPosts.TotalCount.ShouldBe(2); + blogPosts.Items.ShouldNotBeEmpty(); + blogPosts.Items.Count.ShouldBe(2); + } } From dca9f2965bcca342c226dc8a6cc302ee311aa76c Mon Sep 17 00:00:00 2001 From: Engincan VESKE Date: Fri, 25 Mar 2022 09:45:29 +0300 Subject: [PATCH 16/26] Add new localizations for admin website --- .../AbpIoLocalization/Admin/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 023a4b18ed..9f8e88f180 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -380,6 +380,7 @@ "PurchaseItems": "Purchase Items", "SuccessfullyUpdated": "Successfully updated", "SuccessfullyAdded": "Successfully added", - "PurchaseState": "Purchase State" + "PurchaseState": "Purchase State", + "ShowBetweenDayCount": "Show Between Days" } } \ No newline at end of file From a38d0001456975cf10422d5df2399560bc38d763 Mon Sep 17 00:00:00 2001 From: Musa Demir <48536631+demirmusa@users.noreply.github.com> Date: Fri, 25 Mar 2022 18:58:17 +0300 Subject: [PATCH 17/26] use form select for select item --- .../Pages/Public/CmsKit/Blogs/Index.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index dbc0d699ef..4ae3c007c7 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml @@ -25,7 +25,7 @@
- @foreach (var author in Model.Authors) { @@ -76,4 +76,4 @@ - \ No newline at end of file + From 9da22296588163239db5ec193018a0964a8856b1 Mon Sep 17 00:00:00 2001 From: albert <9526587+ebicoglu@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:19:20 +0300 Subject: [PATCH 18/26] Update AspNet-Boilerplate-Migration-Guide.md --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 06a463a5415e149d9293c35b68831681e311910b Mon Sep 17 00:00:00 2001 From: albert <9526587+ebicoglu@users.noreply.github.com> Date: Mon, 28 Mar 2022 13:19:32 +0300 Subject: [PATCH 19/26] Update AspNet-Boilerplate-Migration-Guide.md --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 9e55de04d0b1351b548273df320bf22a856bbd80 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:41:47 +0300 Subject: [PATCH 20/26] CMS Kit - Update Client Proxies --- .../cms-kit-admin-generate-proxy.json | 20 +++++++ ...obalResourcePublicClientProxy.Generated.cs | 27 +++++++++ .../GlobalResourcePublicClientProxy.cs | 7 +++ .../ClientProxies/cms-kit-generate-proxy.json | 58 +++++++++++++++++++ .../wwwroot/client-proxies/cms-kit-proxy.js | 22 +++++++ 5 files changed, 134 insertions(+) create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs create mode 100644 modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json index 6608a2e1b9..1a2814324d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi.Client/ClientProxies/cms-kit-admin-generate-proxy.json @@ -7,6 +7,8 @@ "Volo.CmsKit.Admin.Tags.EntityTagAdminController": { "controllerName": "EntityTagAdmin", "controllerGroupName": "EntityTagAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Tags.EntityTagAdminController", "interfaces": [ { @@ -154,6 +156,8 @@ "Volo.CmsKit.Admin.Tags.TagAdminController": { "controllerName": "TagAdmin", "controllerGroupName": "TagAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Tags.TagAdminController", "interfaces": [ { @@ -422,6 +426,8 @@ "Volo.CmsKit.Admin.Pages.PageAdminController": { "controllerName": "PageAdmin", "controllerGroupName": "PageAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Pages.PageAdminController", "interfaces": [ { @@ -675,6 +681,8 @@ "Volo.CmsKit.Admin.Menus.MenuItemAdminController": { "controllerName": "MenuItemAdmin", "controllerGroupName": "MenuItemAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Menus.MenuItemAdminController", "interfaces": [ { @@ -1000,6 +1008,8 @@ "Volo.CmsKit.Admin.MediaDescriptors.MediaDescriptorAdminController": { "controllerName": "MediaDescriptorAdmin", "controllerGroupName": "MediaDescriptorAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.MediaDescriptors.MediaDescriptorAdminController", "interfaces": [ { @@ -1118,6 +1128,8 @@ "Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController": { "controllerName": "GlobalResourceAdmin", "controllerGroupName": "GlobalResourceAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController", "interfaces": [ { @@ -1182,6 +1194,8 @@ "Volo.CmsKit.Admin.Comments.CommentAdminController": { "controllerName": "CommentAdmin", "controllerGroupName": "CommentAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Comments.CommentAdminController", "interfaces": [ { @@ -1401,6 +1415,8 @@ "Volo.CmsKit.Admin.Blogs.BlogAdminController": { "controllerName": "BlogAdmin", "controllerGroupName": "BlogAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogAdminController", "interfaces": [ { @@ -1654,6 +1670,8 @@ "Volo.CmsKit.Admin.Blogs.BlogFeatureAdminController": { "controllerName": "BlogFeatureAdmin", "controllerGroupName": "BlogFeatureAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogFeatureAdminController", "interfaces": [ { @@ -1760,6 +1778,8 @@ "Volo.CmsKit.Admin.Blogs.BlogPostAdminController": { "controllerName": "BlogPostAdmin", "controllerGroupName": "BlogPostAdmin", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Admin.Blogs.BlogPostAdminController", "interfaces": [ { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs new file mode 100644 index 0000000000..d7354b9e87 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.Generated.cs @@ -0,0 +1,27 @@ +// This file is automatically generated by ABP framework to use MVC Controllers from CSharp +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Http.Client; +using Volo.Abp.Http.Modeling; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Client.ClientProxying; +using Volo.CmsKit.Public.GlobalResources; + +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +[Dependency(ReplaceServices = true)] +[ExposeServices(typeof(IGlobalResourcePublicAppService), typeof(GlobalResourcePublicClientProxy))] +public partial class GlobalResourcePublicClientProxy : ClientProxyBase, IGlobalResourcePublicAppService +{ + public virtual async Task GetGlobalScriptAsync() + { + return await RequestAsync(nameof(GetGlobalScriptAsync)); + } + + public virtual async Task GetGlobalStyleAsync() + { + return await RequestAsync(nameof(GetGlobalStyleAsync)); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs new file mode 100644 index 0000000000..76549aec1e --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/GlobalResourcePublicClientProxy.cs @@ -0,0 +1,7 @@ +// This file is part of GlobalResourcePublicClientProxy, you can customize it here +// ReSharper disable once CheckNamespace +namespace Volo.CmsKit.Public.GlobalResources.ClientProxies; + +public partial class GlobalResourcePublicClientProxy +{ +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json index 0387176b02..f2ff050759 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi.Client/ClientProxies/cms-kit-generate-proxy.json @@ -7,6 +7,8 @@ "Volo.CmsKit.Public.Tags.TagPublicController": { "controllerName": "TagPublic", "controllerGroupName": "TagPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Tags.TagPublicController", "interfaces": [ { @@ -76,6 +78,8 @@ "Volo.CmsKit.Public.Reactions.ReactionPublicController": { "controllerName": "ReactionPublic", "controllerGroupName": "ReactionPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Reactions.ReactionPublicController", "interfaces": [ { @@ -299,6 +303,8 @@ "Volo.CmsKit.Public.Ratings.RatingPublicController": { "controllerName": "RatingPublic", "controllerGroupName": "RatingPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Ratings.RatingPublicController", "interfaces": [ { @@ -502,6 +508,8 @@ "Volo.CmsKit.Public.Pages.PagesPublicController": { "controllerName": "PagesPublic", "controllerGroupName": "PagesPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Pages.PagesPublicController", "interfaces": [ { @@ -551,6 +559,8 @@ "Volo.CmsKit.Public.Menus.MenuItemPublicController": { "controllerName": "MenuItemPublic", "controllerGroupName": "MenuItemPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Menus.MenuItemPublicController", "interfaces": [ { @@ -575,9 +585,55 @@ } } }, + "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController": { + "controllerName": "GlobalResourcePublic", + "controllerGroupName": "GlobalResourcePublic", + "isRemoteService": true, + "apiVersion": null, + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourcePublicController", + "interfaces": [ + { + "type": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + ], + "actions": { + "GetGlobalScriptAsync": { + "uniqueName": "GetGlobalScriptAsync", + "name": "GetGlobalScriptAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/script", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + }, + "GetGlobalStyleAsync": { + "uniqueName": "GetGlobalStyleAsync", + "name": "GetGlobalStyleAsync", + "httpMethod": "GET", + "url": "api/cms-kit-public/global-resources/style", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto", + "typeSimple": "Volo.CmsKit.Public.GlobalResources.GlobalResourceDto" + }, + "allowAnonymous": null, + "implementFrom": "Volo.CmsKit.Public.GlobalResources.IGlobalResourcePublicAppService" + } + } + }, "Volo.CmsKit.Public.Comments.CommentPublicController": { "controllerName": "CommentPublic", "controllerGroupName": "CommentPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Comments.CommentPublicController", "interfaces": [ { @@ -818,6 +874,8 @@ "Volo.CmsKit.Public.Blogs.BlogPostPublicController": { "controllerName": "BlogPostPublic", "controllerGroupName": "BlogPostPublic", + "isRemoteService": true, + "apiVersion": null, "type": "Volo.CmsKit.Public.Blogs.BlogPostPublicController", "interfaces": [ { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js index a135611cac..6b2e3f1b04 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/wwwroot/client-proxies/cms-kit-proxy.js @@ -112,6 +112,28 @@ })(); + // controller volo.cmsKit.public.globalResources.globalResourcePublic + + (function(){ + + abp.utils.createNamespace(window, 'volo.cmsKit.public.globalResources.globalResourcePublic'); + + volo.cmsKit.public.globalResources.globalResourcePublic.getGlobalScript = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/cms-kit-public/global-resources/script', + type: 'GET' + }, ajaxParams)); + }; + + volo.cmsKit.public.globalResources.globalResourcePublic.getGlobalStyle = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/cms-kit-public/global-resources/style', + type: 'GET' + }, ajaxParams)); + }; + + })(); + // controller volo.cmsKit.public.comments.commentPublic (function(){ From b27854d09de42abd1cab740379415f48b0b678e5 Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:45:52 +0300 Subject: [PATCH 21/26] Revert "Update AspNet-Boilerplate-Migration-Guide.md" This reverts commit 06a463a5415e149d9293c35b68831681e311910b. --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index e337b78a6d..52a2fced6a 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# Migrating from ASP.NET Boilerplate to the ABP Framework +# ASP.NET Boilerplate v5+ to ABP Framework Migration ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From 50a0d485d53918655bcf0101463fbf37137650ab Mon Sep 17 00:00:00 2001 From: Enis Necipoglu Date: Mon, 28 Mar 2022 13:46:58 +0300 Subject: [PATCH 22/26] Revert "Revert "Update AspNet-Boilerplate-Migration-Guide.md"" This reverts commit b27854d09de42abd1cab740379415f48b0b678e5. --- docs/en/AspNet-Boilerplate-Migration-Guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index 52a2fced6a..e337b78a6d 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -1,4 +1,4 @@ -# ASP.NET Boilerplate v5+ to ABP Framework Migration +# Migrating from ASP.NET Boilerplate to the ABP Framework ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. From acd72686b40d091d319e50b217b5bf7dc7930261 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 28 Mar 2022 14:40:52 +0300 Subject: [PATCH 23/26] Exception handling: Specify json as Content-Type in response header --- .../ExceptionHandling/AbpExceptionHandlingMiddleware.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index 48ec6121b4..b9d3b83068 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -82,6 +82,7 @@ public class AbpExceptionHandlingMiddleware : IMiddleware, ITransientDependency httpContext.Response.StatusCode = (int)statusCodeFinder.GetStatusCode(httpContext, exception); httpContext.Response.OnStarting(_clearCacheHeadersDelegate, httpContext.Response); httpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); + httpContext.Response.Headers.Add("Content-Type", "application/json"); await httpContext.Response.WriteAsync( jsonSerializer.Serialize( From 5be98cc87d1a5f1e5c41efc435fb036aadb9ef02 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 28 Mar 2022 15:28:42 +0300 Subject: [PATCH 24/26] fix(angular/theming): scriban render problem --- docs/en/UI/Angular/Theming.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Theming.md b/docs/en/UI/Angular/Theming.md index 3b7e3d1afd..c7f303763d 100644 --- a/docs/en/UI/Angular/Theming.md +++ b/docs/en/UI/Angular/Theming.md @@ -227,7 +227,7 @@ import { Router } from '@angular/router'; template: ` - {{ data.textTemplate.text | abpLocalization }} + {%{{{ data.textTemplate.text | abpLocalization }}}%} `, }) From 25a40a960664dca044e9bc2050567f20f1e2c4e9 Mon Sep 17 00:00:00 2001 From: Berkan Sasmaz Date: Mon, 28 Mar 2022 18:15:07 +0300 Subject: [PATCH 25/26] Update en.json --- .../Commercial/Localization/Resources/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 8fa96b5ee2..446d165f21 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -503,6 +503,7 @@ "AdditionalNote": "Additional Note", "OnboardingTrainingFaqTitle": "Do you have ABP onboarding training?", "OnboardingTrainingFaqExplanation": "Yes, we have ABP Training Services to help you get your ABP project started fast. You will learn about ABP from an ABP core team member and you will get the skills to begin your ABP project. In the onboarding training, we will explain how to set up your development environment, install the required tools, create a fully functional CRUD page. The training will be live and the Zoom application will be used, and we are open to using other online meeting platforms. The language of the training will be English. You can also ask your questions about ABP during the sessions. A convenient time and date will be planned for both parties. To get more information, contact us at info@abp.io.", - "AddBasket": "Add to Basket" + "AddBasket": "Add to Basket", + "SendTrainingRequest": "Send Training Request" } } From e8a810ba4bd94bd1d4ca447ec4d8645354c75d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 29 Mar 2022 15:04:20 +0300 Subject: [PATCH 26/26] Check for null for receivedContext.TokenEndpointRequest --- .../DependencyInjection/AbpOpenIdConnectExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs index 02b292a984..894ba470a8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs @@ -57,8 +57,7 @@ public static class AbpOpenIdConnectExtensions if (receivedContext.Request.Cookies.ContainsKey(tenantKey)) { - receivedContext.TokenEndpointRequest.SetParameter(tenantKey, - receivedContext.Request.Cookies[tenantKey]); + receivedContext.TokenEndpointRequest?.SetParameter(tenantKey, receivedContext.Request.Cookies[tenantKey]); } } }