Skip to content

Commit

Permalink
Merge pull request #91 from Central-MakeUs/88-리뷰-신고를-할-수-있다
Browse files Browse the repository at this point in the history
Fix(#88): 신고 내역 있을 때 중복저장 제외
  • Loading branch information
tmddus2 authored Aug 22, 2024
2 parents 0c6ac9b + 9a4b149 commit db04b5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ public void blockUser(Long userId, Long feedId) {

User user = review.getUser();

BlockedUser blockedUser = BlockedUser.builder()
.blockedUserId(user.getId())
.userId(userId)
.build();
if (!blockedUserRepository.existsByUserIdAndBlockedUserId(userId, user.getId())) {
BlockedUser blockedUser = BlockedUser.builder()
.blockedUserId(user.getId())
.userId(userId)
.build();

blockedUserRepository.save(blockedUser);
blockedUserRepository.save(blockedUser);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
import com.example.purithm.domain.user.entity.BlockedUser;

public interface BlockedUserRepository extends JpaRepository<BlockedUser, Long> {
boolean existsByUserIdAndBlockedUserId(Long userId, Long bockedUserId);
}

0 comments on commit db04b5b

Please sign in to comment.