Skip to content

Commit abaa796

Browse files
committed
refactor: count 값 DB에 반영되도록 save 추가
1 parent 513eccc commit abaa796

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/com/example/log4u/domain/map/service/MapService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ private List<DiaryClusterResponseDto> getSiggAreasClusters(double south, double
4848
public void increaseRegionDiaryCount(Double lat, Double lon) {
4949
sidoAreasRepository.findRegionByLatLon(lat, lon)
5050
.flatMap(sido -> sidoAreasDiaryCountRepository.findById(sido.getId()))
51-
.ifPresent(SidoAreasDiaryCount::incrementCount);
51+
.ifPresent(count -> {
52+
count.incrementCount();
53+
sidoAreasDiaryCountRepository.save(count);
54+
});
5255

5356
siggAreasRepository.findRegionByLatLon(lat, lon)
5457
.flatMap(sigg -> siggAreasDiaryCountRepository.findById(sigg.getGid()))
55-
.ifPresent(SiggAreasDiaryCount::incrementCount);
58+
.ifPresent(count -> {
59+
count.incrementCount();
60+
siggAreasDiaryCountRepository.save(count);
61+
});
5662
}
5763
}

0 commit comments

Comments
 (0)