-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Akin/added ordered post list into post app service #2920
Conversation
@@ -9,6 +9,8 @@ public interface IPostAppService : IApplicationService | |||
{ | |||
Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid blogId, string tagName); | |||
|
|||
Task<ListResultDto<PostDto>> GetOrderedListPostsByTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to GetTimeOrderedListAsync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to reuse PostWithDetailsDto
(and fill details).
@@ -18,6 +18,7 @@ public BloggingApplicationAutoMapperProfile() | |||
CreateMap<Blog, BlogDto>(); | |||
CreateMap<BlogUser, BlogUserDto>(); | |||
CreateMap<Post, PostWithDetailsDto>().Ignore(x=>x.Writer).Ignore(x=>x.CommentCount).Ignore(x=>x.Tags); | |||
CreateMap<Post, PostDto>().Ignore(x => x.UserName).Ignore(x => x.CommentCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why added CommentCount if not used?
return new ListResultDto<PostWithDetailsDto>(postDtos); | ||
} | ||
|
||
public async Task<ListResultDto<PostDto>> GetOrderedListPostsByTime() | ||
{ | ||
var posts = (await _postRepository.GetListAsync()).OrderByDescending(x => x.CreationTime).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not ordering in the database? Also, getting all posts (without even a blogId filter) seems wrong to me.
@@ -27,6 +27,13 @@ public Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid bl | |||
return _postAppService.GetListByBlogIdAndTagName(blogId, tagName); | |||
} | |||
|
|||
|
|||
[HttpGet] | |||
public Task<ListResultDto<PostDto>> GetOrderedListPostsByTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing [Route]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Route("{blogId}/all/by-time")]
@akinix what is the issue related to this PR? |
No description provided.