Browse Source

Refactor CommentPublicAppService

pull/5067/head
Halil İbrahim Kalkan 6 years ago
parent
commit
1926d58865
  1. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs
  2. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/ICommentPublicAppService.cs
  3. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Comments/CommentPublicAppService.cs
  4. 4
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs
  5. 2
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs
  6. 2
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs

2
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 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
} }
} }

2
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 public interface ICommentPublicAppService : IApplicationService
{ {
Task<ListResultDto<CommentWithDetailsDto>> GetAllForEntityAsync(string entityType, string entityId); Task<ListResultDto<CommentWithDetailsDto>> GetListAsync(string entityType, string entityId);
Task<CommentDto> CreateAsync(CreateCommentInput input); Task<CommentDto> CreateAsync(CreateCommentInput input);

2
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; CmsUserLookupService = cmsUserLookupService;
} }
public virtual async Task<ListResultDto<CommentWithDetailsDto>> GetAllForEntityAsync(string entityType, string entityId) public virtual async Task<ListResultDto<CommentWithDetailsDto>> GetListAsync(string entityType, string entityId)
{ {
var commentsWithAuthor = await CommentRepository.GetListWithAuthorsAsync(entityType, entityId); var commentsWithAuthor = await CommentRepository.GetListWithAuthorsAsync(entityType, entityId);

4
modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Comments/CommentPublicController.cs

@ -20,9 +20,9 @@ namespace Volo.CmsKit.Public.Comments
[HttpGet] [HttpGet]
[Route("{entityType}/{entityId}")] [Route("{entityType}/{entityId}")]
public Task<ListResultDto<CommentWithDetailsDto>> GetAllForEntityAsync(string entityType, string entityId) public Task<ListResultDto<CommentWithDetailsDto>> GetListAsync(string entityType, string entityId)
{ {
return CommentPublicAppService.GetAllForEntityAsync(entityType, entityId); return CommentPublicAppService.GetListAsync(entityType, entityId);
} }
[HttpPost] [HttpPost]

2
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<IViewComponentResult> InvokeAsync(string entityType, string entityId, string loginUrl = null) public virtual async Task<IViewComponentResult> 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 var viewModel = new CommentingViewModel
{ {

2
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Comments/CommentPublicAppService_Tests.cs

@ -30,7 +30,7 @@ namespace Volo.CmsKit.Comments
[Fact] [Fact]
public async Task GetAllForEntityAsync() 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.Count.ShouldBe(2);
list.Items.First().Replies.Count.ShouldBe(2); list.Items.First().Replies.Count.ShouldBe(2);

Loading…
Cancel
Save