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 diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index 8fa96b5ee2..0d7724df56 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", @@ -503,6 +505,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" } } 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. 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 }}}%} `, }) 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]); } } } 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( 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..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 @@ -1,10 +1,23 @@ -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 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..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: "direct", + type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ), new QueueDeclareConfiguration( @@ -244,7 +244,7 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe { channel.ExchangeDeclare( AbpRabbitMqEventBusOptions.ExchangeName, - "direct", + AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(), durable: true ); 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"; + } } 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..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 @@ -89,9 +89,10 @@ 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); + 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.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.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index 8b1e86f8b7..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 @@ -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; @@ -11,11 +12,13 @@ public interface IBlogPostRepository : IBasicRepository Task GetCountAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, CancellationToken cancellationToken = default); Task> GetListAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -24,4 +27,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 f0a6aa61ee..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)); @@ -54,6 +56,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 +69,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); @@ -95,4 +99,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 3583fdfc68..1db7fee75e 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) { cancellationToken = GetCancellationToken(cancellationToken); @@ -49,12 +50,15 @@ 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(cancellationToken); + } public virtual async Task> GetListAsync( string filter = null, Guid? blogId = null, + Guid? authorId = null, int maxResultCount = int.MaxValue, int skipCount = 0, string sorting = null, @@ -68,7 +72,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); @@ -99,4 +104,22 @@ public class MongoBlogPostRepository : MongoDbRepository x.BlogId == blogId && x.Slug.ToLower() == slug, cancellationToken); } + + public async Task> GetAuthorsHasBlogPosts(CancellationToken cancellationToken = default) + { + 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)); + } } 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..b471171f3b --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/BlogPostGetListInput.cs @@ -0,0 +1,9 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Volo.CmsKit.Public.Blogs; + +public class BlogPostGetListInput : PagedAndSortedResultRequestDto +{ + 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..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 @@ -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([NotNull] string blogSlug, PagedAndSortedResultRequestDto input); + Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input); Task GetAsync([NotNull] string blogSlug, [NotNull] string blogPostSlug); + + 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 4160639815..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 @@ -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,14 +34,21 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub return ObjectMapper.Map(blogPost); } - public virtual async Task> GetListAsync([NotNull] string blogSlug, PagedAndSortedResultRequestDto input) + public virtual async Task> GetListAsync([NotNull] string blogSlug, BlogPostGetListInput input) { var blog = await BlogRepository.GetBySlugAsync(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), + await BlogPostRepository.GetCountAsync(blogId: blog.Id, authorId: input.AuthorId), ObjectMapper.Map, List>(blogPosts)); } + + 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 c96e37f579..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 @@ -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> GetAuthorsHasBlogPostsAsync() + { + return await RequestAsync>(nameof(GetAuthorsHasBlogPostsAsync)); + } } 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.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Blogs/BlogPostPublicController.cs index bdd0b2cf32..8a788f7a34 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; @@ -31,8 +33,15 @@ public class BlogPostPublicController : CmsKitPublicControllerBase, IBlogPostPub [HttpGet] [Route("{blogSlug}")] - public virtual Task> GetListAsync(string blogSlug, PagedAndSortedResultRequestDto input) + public virtual Task> GetListAsync(string blogSlug, BlogPostGetListInput input) { return BlogPostPublicAppService.GetListAsync(blogSlug, input); } -} + + [HttpGet] + [Route("authors")] + public virtual Task> GetAuthorsHasBlogPostsAsync() + { + return BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); + } +} \ 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 90f16c18fd..2c29649dd3 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 @@ -38,8 +38,9 @@ var isScrollIndexEnabled = GlobalFeatureManager.Instance.IsEnabled(); } +
-
+
@@ -47,10 +48,11 @@

@Model.BlogPost.Title

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

- @if (!Model.BlogPost.Content.IsNullOrEmpty()) { @Html.Raw(await MarkdownRenderer.RenderAsync(Model.BlogPost.Content)) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/Index.cshtml index 32c5585f8e..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 @@ -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 30d4c6bcf2..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 @@ -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; } @@ -35,10 +42,13 @@ public class IndexModel : CmsKitPublicPageModelBase { Blogs = await BlogPostPublicAppService.GetListAsync( BlogSlug, - new PagedAndSortedResultRequestDto + new BlogPostGetListInput { SkipCount = PageSize * (CurrentPage - 1), - MaxResultCount = PageSize + MaxResultCount = PageSize, + AuthorId = AuthorId }); + + Authors = await BlogPostPublicAppService.GetAuthorsHasBlogPostsAsync(); } } 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); + } +}); 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(){ 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..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,16 +18,26 @@ 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] 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); @@ -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); + } } 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); + } }