Skip to content

Commit

Permalink
fix: 동네생활 좋아요 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
nohy6630 committed Apr 15, 2024
1 parent 0288fdd commit 3226e8c
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public Integer decreaseArticleLike(Long articleId) {

// 사용자의 게시글 좋아요 목록에서 제거
List<ArticleLike> articleLikeList = articleLikeRepository.findByMember(member);
articleLikeList.removeIf(articleLike -> articleLike.getArticleId().equals(articleId));
articleLikeList.forEach(articleLike -> {
if (articleLike.getArticleId().equals(articleId))
articleLikeRepository.delete(articleLike);
});

return article.getLikeCount();
}
Expand All @@ -108,7 +111,6 @@ public Integer increaseCommentLike(Long commentId) {
commentLikeRepository.save(new CommentLike(member, commentEntity));



Long ownerId = commentEntity.getAuthorId();
Member owner = memberRepository.findById(ownerId)
.orElseThrow(NotFoundMemberException::new);
Expand Down Expand Up @@ -139,7 +141,10 @@ public Integer decreaseCommentLike(Long commentId) {
commentEntity.decreaseLikeCount();
// 사용자의 댓글 좋아요 목록에서 제거
List<CommentLike> commentLikeList = commentLikeRepository.findByMember(member);
commentLikeList.removeIf(commentLike -> commentLike.getCommentId().equals(commentId));
commentLikeList.forEach(commentLike -> {
if (commentLike.getCommentId().equals(commentId))
commentLikeRepository.delete(commentLike);
});

return commentEntity.getLikeCount();
}
Expand Down

0 comments on commit 3226e8c

Please sign in to comment.