Skip to content
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

Merged
merged 6 commits into from
Mar 2, 2020

Conversation

AkinSabriCam
Copy link
Contributor

No description provided.

@@ -9,6 +9,8 @@ public interface IPostAppService : IApplicationService
{
Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid blogId, string tagName);

Task<ListResultDto<PostDto>> GetOrderedListPostsByTime();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to GetTimeOrderedListAsync

Copy link
Member

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);
Copy link
Member

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();
Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing [Route]?

Copy link
Member

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")]

@hikalkan
Copy link
Member

hikalkan commented Mar 2, 2020

@akinix what is the issue related to this PR?

@yekalkan yekalkan merged commit 5ca6d00 into dev Mar 2, 2020
@hikalkan hikalkan deleted the akin/Added-orderedPostList-into-PostAppService branch March 5, 2020 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants