-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/#658 자신이 작성한 피드 목록 조회 #675
The head ref may contain hidden characters: "Feature/#658-\uC790\uC2E0\uC774_\uC791\uC131\uD55C_\uD53C\uB4DC_\uBAA9\uB85D_\uC870\uD68C"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,4 +129,24 @@ private void validateDeletedFeed(final Feed feed) { | |
throw new FeedException(FeedExceptionType.FORBIDDEN_DELETED_FEED); | ||
} | ||
} | ||
|
||
public List<FeedSimpleResponse> findAllMyFeeds(final Member member) { | ||
final List<Feed> feeds = feedRepository.findByMember(member); | ||
|
||
final List<Long> feedIds = feeds.stream() | ||
.map(Feed::getId) | ||
.collect(Collectors.toList()); | ||
|
||
final Map<Long, Long> feedCommentCounts = getFeedIdCommentCountMap(feedIds); | ||
final Map<Long, List<Image>> feedImages = getFeedImagesMap(feedIds); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 내가 쓴 피드 목록을 볼 때 모든 이미지가 필요한가요?? 화면이 제대로 없어서 잘 모르겠지만, 썸네일만 보여주지 않을까라는 생각이 듭니다 이 부분이 안드 분과 논의된 내용인지 말씀해주시면 좋을 것 같습니다 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 기존 피드 목록과 api를 완전히 통일해 달라는 요청이 있었기 때문에 이처럼 구현했습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅇㅈ 추후 생략해야 할 것 같아요 |
||
|
||
return feeds.stream() | ||
.map(feed -> { | ||
final List<Image> images = feedImages.getOrDefault(feed.getId(), Collections.emptyList()); | ||
final Long commentCount = feedCommentCounts.getOrDefault(feed.getId(), | ||
DEFAULT_COMMENT_COUNT); | ||
return FeedSimpleResponse.from(feed, images, commentCount); | ||
}) | ||
.collect(Collectors.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.
의견을 낼 때, 다른 제안을 같이 드려야하는데 뭔가 my 보다 좋은게 없는 것 같기도 하고,,
다른 분들은 어떻게 생각하시나요?
/feeds/my
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.
저도 이 부분은 고민이 많았었는데
feeds/my
와feeds?member-id={member-id}
중feeds/my
를 선택했습니다.이유는 이미
Member
를 파라미터로 받고 있는데 사용자의 id를 추가로 받을 경우 불필요한 파라미터가 추가되고 유효성 검사를 해주어야 하는데 이 또한member-id
를 받지 않으면 유효성 검사를 되므로 불필요하다고 생각했기 때문입니다.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.
전 조금 애매한 것 같아요.
사실 member-id를 따로 받는 것이 조금 더 정석적이긴 하지만, 굳이 해야하나? 라는 생각이 들기도 하더라고요.
그리고 , /feeds?member-id = 형식으로 짜면
위에 /feeds?event-id = 랑 겹쳐서 문제가 생길거에요.
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.
전 확장성을 고려했을 때
/feeds/member-id={member_id}
도 괜찮은 것 같아요. 특정 사용자가 작성한 feed 목록을 조회하는 요구사항이 생긴다면 유연하게 사용할 수 있을 것 같아서요~!