Browse Source

Refactoring

pull/8491/head
EngincanV 5 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<Post, PostCacheItem>().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags);
CreateMap<PostCacheItem, PostWithDetailsDto>()
.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);
}
}
}

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 postCacheItems = ObjectMapper.Map<List<Post>, List<PostCacheItem>>(posts);
return postCacheItems;
return ObjectMapper.Map<List<Post>, List<PostCacheItem>>(posts);
}
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
{
[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<Tag> Tags { get; set; }
public Guid? CreatorId { get; set; }
public Guid? CreatorId { get; set; }
public DateTime CreationTime { get; set; }
}
}
Loading…
Cancel
Save