CmsKit - Add CommentDetailedDto

pull/7955/head
enisn 5 years ago
parent b3c6cf8b20
commit fcb7b21b51

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

@ -18,7 +18,7 @@ namespace Volo.CmsKit.Public.Comments
public DateTime CreationTime { get; set; }
public List<CommentDto> Replies { get; set; }
public List<CommentDetailedDto> Replies { get; set; }
public CmsUserDto Author { get; set; }
}

@ -9,9 +9,9 @@ namespace Volo.CmsKit.Public.Comments
{
Task<ListResultDto<CommentWithDetailsDto>> GetListAsync(string entityType, string entityId);
Task<CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input);
Task<CommentDetailedDto> CreateAsync(string entityType, string entityId, CreateCommentInput input);
Task<CommentDto> UpdateAsync(Guid id, UpdateCommentInput input);
Task<CommentDetailedDto> UpdateAsync(Guid id, UpdateCommentInput input);
Task DeleteAsync(Guid id);
}

@ -48,7 +48,7 @@ namespace Volo.CmsKit.Public.Comments
}
[Authorize]
public virtual async Task<CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input)
public virtual async Task<CommentDetailedDto> 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, CommentDto>(comment);
return ObjectMapper.Map<Comment, CommentDetailedDto>(comment);
}
[Authorize]
public virtual async Task<CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
public virtual async Task<CommentDetailedDto> 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<Comment, CommentDto>(updatedComment);
return ObjectMapper.Map<Comment, CommentDetailedDto>(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<Comment, CommentDto>(c.Comment))
.Select(c => ObjectMapper.Map<Comment, CommentDetailedDto>(c.Comment))
.ToList();
foreach (var reply in parentComment.Replies)

@ -18,7 +18,7 @@ namespace Volo.CmsKit.Public
{
CreateMap<CmsUser, Comments.CmsUserDto>();
CreateMap<Comment, CommentDto>()
CreateMap<Comment, CommentDetailedDto>()
.Ignore(x=> x.Author);
CreateMap<Comment, CommentWithDetailsDto>()

@ -30,14 +30,14 @@ namespace Volo.CmsKit.Public.Comments
[HttpPost]
[Route("{entityType}/{entityId}")]
public Task<CommentDto> CreateAsync(string entityType, string entityId, CreateCommentInput input)
public Task<CommentDetailedDto> CreateAsync(string entityType, string entityId, CreateCommentInput input)
{
return CommentPublicAppService.CreateAsync(entityType, entityId, input);
}
[HttpPut]
[Route("{id}")]
public Task<CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
public Task<CommentDetailedDto> UpdateAsync(Guid id, UpdateCommentInput input)
{
return CommentPublicAppService.UpdateAsync(id, input);
}

Loading…
Cancel
Save