Skip to content

Commit

Permalink
Merge pull request #160 from fastcampus-711/develop
Browse files Browse the repository at this point in the history
[hotfix] 댓글 오류
  • Loading branch information
having-dlrow authored Jun 12, 2024
2 parents b5d0268 + 48fd553 commit 7e22fa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -105,7 +106,8 @@ public Page<CommentDto> getPostWithComment(MemberDto memberDto, long postId, Pag
Page<Comment> commentsPage = commentRepository.findAllByPostIdAndParentCommentIdIsNull(postId, pageable);

// reaction
Map<Long, ReactionType> mapCommentIdAndReactionType = commentReactionRepository.findByUserIdAndDtype(memberDto.getId(), "CommentReaction")
Map<Long, ReactionType> mapCommentIdAndReactionType = commentReactionRepository.findByUserIdAndDtypeAndTargetId(memberDto.getId(), "CommentReaction", postId)
.orElse(Collections.emptyList())
.stream()
.collect(Collectors.toMap(CommentReaction::getTargetId, CommentReaction::getReactionType));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public interface ReactionRepository<E extends Reaction> extends JpaRepository<E,
Optional<E> findByUserIdAndTargetIdAndDtype(long userId, long targetId, String postReaction);

// post get
List<E> findByUserIdAndDtype(long memberId, String commentReaction);
Optional<List<E>> findByUserIdAndDtypeAndTargetId(long memberId, String commentReaction, long targetId);
}

0 comments on commit 7e22fa7

Please sign in to comment.