Browse Source

Refactoring

pull/8491/head
EngincanV 6 years ago
parent
commit
4fcf7fafda
  1. 12
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs
  2. 4
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs
  3. 6
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs

12
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationAutoMapperProfile.cs

@ -22,14 +22,10 @@ namespace Volo.Blogging
CreateMap<Tag, TagDto>(); CreateMap<Tag, TagDto>();
CreateMap<Post, PostCacheItem>().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags); CreateMap<Post, PostCacheItem>().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags);
CreateMap<PostCacheItem, PostWithDetailsDto>() CreateMap<PostCacheItem, PostWithDetailsDto>()
.Ignore(x=>x.LastModificationTime) .IgnoreModificationAuditedObjectProperties()
.Ignore(x=>x.LastModifierId) .IgnoreDeletionAuditedObjectProperties()
.Ignore(x=>x.DeleterId) .Ignore(x => x.CommentCount)
.Ignore(x=>x.IsDeleted) .Ignore(x => x.Tags);
.Ignore(x=>x.DeletionTime)
.Ignore(x=>x.CommentCount)
.Ignore(x=>x.Tags);
} }
} }
} }

4
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 posts = await _postRepository.GetOrderedList(blogId);
var postCacheItems = ObjectMapper.Map<List<Post>, List<PostCacheItem>>(posts); return ObjectMapper.Map<List<Post>, List<PostCacheItem>>(posts);
return postCacheItems;
} }
private async Task<string> RenameUrlIfItAlreadyExistAsync(Guid blogId, string url, Post existingPost = null) private async Task<string> RenameUrlIfItAlreadyExistAsync(Guid blogId, string url, Post existingPost = null)

6
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Posts/PostCacheItem.cs

@ -9,9 +9,10 @@ using Volo.Blogging.Users;
namespace Volo.Blogging.Posts namespace Volo.Blogging.Posts
{ {
[Serializable] [Serializable]
public class PostCacheItem public class PostCacheItem : ICreationAuditedObject
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public Guid BlogId { get; set; } public Guid BlogId { get; set; }
public string Title { get; set; } public string Title { get; set; }
@ -32,8 +33,9 @@ namespace Volo.Blogging.Posts
public BlogUser Writer { get; set; } public BlogUser Writer { get; set; }
public List<Tag> Tags { get; set; } public List<Tag> Tags { get; set; }
public Guid? CreatorId { get; set; }
public Guid? CreatorId { get; set; }
public DateTime CreationTime { get; set; } public DateTime CreationTime { get; set; }
} }
} }
Loading…
Cancel
Save