From 87ae374432f6097b5c89645573e051ef4c3fbe21 Mon Sep 17 00:00:00 2001 From: seohyun-lee Date: Wed, 21 Aug 2024 05:13:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20home=20api=EC=97=90=20=ED=8A=B8=EB=9E=9C?= =?UTF-8?q?=EC=9E=AD=EC=85=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/HomeService.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/sws/songpin/domain/member/service/HomeService.java b/src/main/java/sws/songpin/domain/member/service/HomeService.java index 18fedce..e26fa22 100644 --- a/src/main/java/sws/songpin/domain/member/service/HomeService.java +++ b/src/main/java/sws/songpin/domain/member/service/HomeService.java @@ -22,10 +22,11 @@ public class HomeService { private final PinRepository pinRepository; private final PlaceRepository placeRepository; + @Transactional(readOnly = true) public HomeResponseDto getHome() { Member currentMember = memberService.getCurrentMember(); - List pins = findTop3ByOrderByPinIdDesc(); - List places = findTop3ByOrderByPlaceIdDesc(); + List pins = pinRepository.findTop3ByOrderByPinIdDesc(); + List places = placeRepository.findTop3ByOrderByPlaceIdDesc(); // pinList List pinList = pins.stream() .map(pin -> PinBasicUnitDto.from(pin, pin.getCreator().equals(currentMember))) @@ -39,14 +40,4 @@ public HomeResponseDto getHome() { .collect(Collectors.toList()); return HomeResponseDto.from(currentMember, pinList, placeList); } - - @Transactional(readOnly = true) - public List findTop3ByOrderByPinIdDesc() { - return pinRepository.findTop3ByOrderByPinIdDesc(); - } - - @Transactional(readOnly = true) - public List findTop3ByOrderByPlaceIdDesc() { - return placeRepository.findTop3ByOrderByPlaceIdDesc(); - } }