Refactor CommentPublicAppService

pull/5067/head
Halil İbrahim Kalkan 5 years ago
parent dddc30c658
commit 1926d58865

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

@ -7,7 +7,7 @@ namespace Volo.CmsKit.Public.Comments
{
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);

@ -29,7 +29,7 @@ namespace Volo.CmsKit.Public.Comments
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);

@ -20,9 +20,9 @@ namespace Volo.CmsKit.Public.Comments
[HttpGet]
[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]

@ -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)
{
var result = await CommentPublicAppService.GetAllForEntityAsync(entityType, entityId);
var result = await CommentPublicAppService.GetListAsync(entityType, entityId);
var viewModel = new CommentingViewModel
{

@ -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);

Loading…
Cancel
Save