Skip to content

Commit

Permalink
hotfix/bookmark-total: 전체 북마크 조회 시 오류 났던 filter 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
KooSuYeon committed Jan 7, 2025
1 parent 1c99180 commit edd41c4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/java/com/dife/api/service/BookmarkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@ public List<BookmarkResponseDto> getAllBookmarks(String memberEmail) {
Set<Member> blockedMembers = blockService.getBlackSet(member);

return bookmarks.stream()
.filter(bookmark -> !blockedMembers.contains(bookmark.getPost().getWriter()))
.filter(bookmark -> !blockPostRepository.existsByPostAndMember(bookmark.getPost(), member))
.filter(
bookmark ->
bookmark.getPost() == null
|| !blockedMembers.contains(bookmark.getPost().getWriter()))
.filter(
bookmark ->
bookmark.getPost() == null
|| !blockPostRepository.existsByPostAndMember(bookmark.getPost(), member))
.map(
bookmark -> {
BookmarkResponseDto responseDto =
modelMapper.map(bookmark, BookmarkResponseDto.class);
if (bookmark.getMessage() == null)
responseDto.setPost(postService.getPost(bookmark.getPost().getId(), memberEmail));
if (bookmark.getPost() != null) {
if (bookmark.getMessage() == null) {
responseDto.setPost(postService.getPost(bookmark.getPost().getId(), memberEmail));
}
}
return responseDto;
})
.collect(toList());
Expand Down

0 comments on commit edd41c4

Please sign in to comment.