From 4fcf7fafdaf4c23df1ce3b63c8de83feaf626eba Mon Sep 17 00:00:00 2001 From: EngincanV Date: Wed, 7 Apr 2021 16:08:48 +0300 Subject: [PATCH] Refactoring --- .../Blogging/BloggingApplicationAutoMapperProfile.cs | 12 ++++-------- .../Volo/Blogging/Posts/PostAppService.cs | 4 +--- .../Volo/Blogging/Posts/PostCacheItem.cs | 6 ++++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs index 2d40c7fad9..b2113926ad 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs @@ -22,14 +22,10 @@ namespace Volo.Blogging CreateMap(); CreateMap().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags); CreateMap() - .Ignore(x=>x.LastModificationTime) - .Ignore(x=>x.LastModifierId) - .Ignore(x=>x.DeleterId) - .Ignore(x=>x.IsDeleted) - .Ignore(x=>x.DeletionTime) - .Ignore(x=>x.CommentCount) - .Ignore(x=>x.Tags); - + .IgnoreModificationAuditedObjectProperties() + .IgnoreDeletionAuditedObjectProperties() + .Ignore(x => x.CommentCount) + .Ignore(x => x.Tags); } } } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 9e8acba57d..d804e7a004 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -209,9 +209,7 @@ namespace Volo.Blogging.Posts { var posts = await _postRepository.GetOrderedList(blogId); - var postCacheItems = ObjectMapper.Map, List>(posts); - - return postCacheItems; + return ObjectMapper.Map, List>(posts); } private async Task RenameUrlIfItAlreadyExistAsync(Guid blogId, string url, Post existingPost = null) diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs index f08424aaf1..450feec9dd 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs @@ -9,9 +9,10 @@ using Volo.Blogging.Users; namespace Volo.Blogging.Posts { [Serializable] - public class PostCacheItem + public class PostCacheItem : ICreationAuditedObject { public Guid Id { get; set; } + public Guid BlogId { get; set; } public string Title { get; set; } @@ -32,8 +33,9 @@ namespace Volo.Blogging.Posts public BlogUser Writer { get; set; } public List Tags { get; set; } - public Guid? CreatorId { get; set; } + public Guid? CreatorId { get; set; } + public DateTime CreationTime { get; set; } } } \ No newline at end of file