From 1926d588658664d617234da83fea08af2aa8d06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 15 Aug 2020 14:27:58 +0300 Subject: [PATCH] Refactor CommentPublicAppService --- .../Volo/CmsKit/Public/Comments/CommentDto.cs | 2 +- .../Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs | 2 +- .../Volo/CmsKit/Public/Comments/CommentPublicAppService.cs | 2 +- .../Volo/CmsKit/Public/Comments/CommentPublicController.cs | 4 ++-- .../Shared/Components/Commenting/CommentingViewComponent.cs | 2 +- .../Comments/CommentPublicAppService_Tests.cs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs index f7bdf27d13..106ca46802 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs @@ -18,6 +18,6 @@ namespace Volo.CmsKit.Public.Comments public DateTime CreationTime { get; set; } - public CmsUserDto Author { get; set; } + public CmsUserDto Author { get; set; } //TODO: Should only have AuthorId for the basic dto. see https://docs.abp.io/en/abp/latest/Best-Practices/Application-Services } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs index 8f13c7fb05..260b2646a5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs @@ -7,7 +7,7 @@ namespace Volo.CmsKit.Public.Comments { public interface ICommentPublicAppService : IApplicationService { - Task> GetAllForEntityAsync(string entityType, string entityId); + Task> GetListAsync(string entityType, string entityId); Task CreateAsync(CreateCommentInput input); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs index 836dbcb1d1..576ff14b27 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs @@ -29,7 +29,7 @@ namespace Volo.CmsKit.Public.Comments CmsUserLookupService = cmsUserLookupService; } - public virtual async Task> GetAllForEntityAsync(string entityType, string entityId) + public virtual async Task> GetListAsync(string entityType, string entityId) { var commentsWithAuthor = await CommentRepository.GetListWithAuthorsAsync(entityType, entityId); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs index 22c121ce58..7611c3bc7f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs @@ -20,9 +20,9 @@ namespace Volo.CmsKit.Public.Comments [HttpGet] [Route("{entityType}/{entityId}")] - public Task> GetAllForEntityAsync(string entityType, string entityId) + public Task> GetListAsync(string entityType, string entityId) { - return CommentPublicAppService.GetAllForEntityAsync(entityType, entityId); + return CommentPublicAppService.GetListAsync(entityType, entityId); } [HttpPost] diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs index ceafd07134..25a763e3d2 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs @@ -26,7 +26,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting public virtual async Task InvokeAsync(string entityType, string entityId, string loginUrl = null) { - var result = await CommentPublicAppService.GetAllForEntityAsync(entityType, entityId); + var result = await CommentPublicAppService.GetListAsync(entityType, entityId); var viewModel = new CommentingViewModel { diff --git a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs index f02339dde8..ded505dcaf 100644 --- a/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs +++ b/modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.CmsKit.Comments [Fact] public async Task GetAllForEntityAsync() { - var list = await _commentAppService.GetAllForEntityAsync(_cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); + var list = await _commentAppService.GetListAsync(_cmsKitTestData.EntityType1, _cmsKitTestData.EntityId1); list.Items.Count.ShouldBe(2); list.Items.First().Replies.Count.ShouldBe(2);