Skip to content

Commit

Permalink
fix: 추천 지역 수정 시 기존 데이터 삭제할 때 발생하는 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
yujung7768903 committed Feb 4, 2024
1 parent c5a9a3f commit b3190bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ private List<VoteSelectResultResponse.VoteStatus> toVoteStatusResponse(Users use
}

private void saveUserVotesForSelectPlaces(List<Long> selectPlaceIds, Users user, Vote vote) {
List<BestPlace> selectPlaces = bestPlaceRepository.findAllById(selectPlaceIds);
for (BestPlace selectPlace : selectPlaces) {
List<BestPlace> bestPlaces = bestPlaceRepository.findAllById(selectPlaceIds);
for (BestPlace bestPlace : bestPlaces) {
selectPlaceRepository.save(
SelectPlace.builder()
.bestPlace(selectPlace)
.bestPlace(bestPlace)
.vote(vote)
.userId(user.getUserId())
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ private void removeParticipation(Participation participate, Groups group) {

private void updateBestRegion(Groups group) {
// best-place 테이블에서 관련 정보 삭제
bestPlaceRepository.deleteAllInBatch(bestPlaceRepository.findAllByGroup(group));
List<BestPlace> bestPlaces = bestPlaceRepository.findAllByGroup(group);
for (BestPlace bestPlace : bestPlaces) {
bestPlaceRepository.delete(bestPlace);
}

// 관련 Redis 삭제
redisDao.deleteSpringCache(CacheName.group, group.getGroupId().toString());
Expand Down

0 comments on commit b3190bb

Please sign in to comment.