From fcb7b21b519dbf8fee5b6a0063f5d0fe4c5a3259 Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 8 Mar 2021 10:14:34 +0300 Subject: [PATCH] CmsKit - Add CommentDetailedDto --- .../Comments/{CommentDto.cs => CommentDetailedDto.cs} | 4 ++-- .../CmsKit/Public/Comments/CommentWithDetailsDto.cs | 2 +- .../CmsKit/Public/Comments/ICommentPublicAppService.cs | 4 ++-- .../CmsKit/Public/Comments/CommentPublicAppService.cs | 10 +++++----- .../Public/PublicApplicationAutoMapperProfile.cs | 2 +- .../CmsKit/Public/Comments/CommentPublicController.cs | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) rename modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/{CommentDto.cs => CommentDetailedDto.cs} (67%) 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/CommentDetailedDto.cs similarity index 67% rename from modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDto.cs rename to modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentDetailedDto.cs index 0c6e2a21bf..e1098aefe7 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/CommentDetailedDto.cs @@ -3,7 +3,7 @@ namespace Volo.CmsKit.Public.Comments { [Serializable] - public class CommentDto + public class CommentDetailedDto { public Guid Id { get; set; } @@ -19,6 +19,6 @@ namespace Volo.CmsKit.Public.Comments public DateTime CreationTime { 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 + public CmsUserDto Author { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentWithDetailsDto.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentWithDetailsDto.cs index 3c5b074a86..5bc6a923b1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentWithDetailsDto.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Comments/CommentWithDetailsDto.cs @@ -18,7 +18,7 @@ namespace Volo.CmsKit.Public.Comments public DateTime CreationTime { get; set; } - public List Replies { get; set; } + public List Replies { get; set; } public CmsUserDto Author { get; set; } } 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 8ac8c92988..f441de78cc 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 @@ -9,9 +9,9 @@ namespace Volo.CmsKit.Public.Comments { Task> GetListAsync(string entityType, string entityId); - Task CreateAsync(string entityType, string entityId, CreateCommentInput input); + Task CreateAsync(string entityType, string entityId, CreateCommentInput input); - Task UpdateAsync(Guid id, UpdateCommentInput input); + Task UpdateAsync(Guid id, UpdateCommentInput input); Task DeleteAsync(Guid id); } 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 d5dd555b71..e67de25b5a 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 @@ -48,7 +48,7 @@ namespace Volo.CmsKit.Public.Comments } [Authorize] - public virtual async Task CreateAsync(string entityType, string entityId, CreateCommentInput input) + public virtual async Task CreateAsync(string entityType, string entityId, CreateCommentInput input) { var user = await CmsUserLookupService.GetByIdAsync(CurrentUser.GetId()); @@ -75,11 +75,11 @@ namespace Volo.CmsKit.Public.Comments Id = comment.Id }); - return ObjectMapper.Map(comment); + return ObjectMapper.Map(comment); } [Authorize] - public virtual async Task UpdateAsync(Guid id, UpdateCommentInput input) + public virtual async Task UpdateAsync(Guid id, UpdateCommentInput input) { var comment = await CommentRepository.GetAsync(id); @@ -92,7 +92,7 @@ namespace Volo.CmsKit.Public.Comments var updatedComment = await CommentRepository.UpdateAsync(comment); - return ObjectMapper.Map(updatedComment); + return ObjectMapper.Map(updatedComment); } [Authorize] @@ -123,7 +123,7 @@ namespace Volo.CmsKit.Public.Comments parentComment.Replies = comments .Where(c => c.Comment.RepliedCommentId == parentComment.Id) - .Select(c => ObjectMapper.Map(c.Comment)) + .Select(c => ObjectMapper.Map(c.Comment)) .ToList(); foreach (var reply in parentComment.Replies) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs index b8684f2463..6166c0a9d9 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/PublicApplicationAutoMapperProfile.cs @@ -18,7 +18,7 @@ namespace Volo.CmsKit.Public { CreateMap(); - CreateMap() + CreateMap() .Ignore(x=> x.Author); CreateMap() 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 1b5b2cc64d..8bd78a38d4 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 @@ -30,14 +30,14 @@ namespace Volo.CmsKit.Public.Comments [HttpPost] [Route("{entityType}/{entityId}")] - public Task CreateAsync(string entityType, string entityId, CreateCommentInput input) + public Task CreateAsync(string entityType, string entityId, CreateCommentInput input) { return CommentPublicAppService.CreateAsync(entityType, entityId, input); } [HttpPut] [Route("{id}")] - public Task UpdateAsync(Guid id, UpdateCommentInput input) + public Task UpdateAsync(Guid id, UpdateCommentInput input) { return CommentPublicAppService.UpdateAsync(id, input); }