Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
seohyun-lee committed Aug 20, 2024
2 parents d762297 + 9c80807 commit 28c80b0
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/main/java/sws/songpin/domain/member/service/HomeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pin> pins = findTop3ByOrderByPinIdDesc();
List<Place> places = findTop3ByOrderByPlaceIdDesc();
List<Pin> pins = pinRepository.findTop3ByOrderByPinIdDesc();
List<Place> places = placeRepository.findTop3ByOrderByPlaceIdDesc();
// pinList
List<PinBasicUnitDto> pinList = pins.stream()
.map(pin -> PinBasicUnitDto.from(pin, pin.getCreator().equals(currentMember)))
Expand All @@ -39,14 +40,4 @@ public HomeResponseDto getHome() {
.collect(Collectors.toList());
return HomeResponseDto.from(currentMember, pinList, placeList);
}

@Transactional(readOnly = true)
public List<Pin> findTop3ByOrderByPinIdDesc() {
return pinRepository.findTop3ByOrderByPinIdDesc();
}

@Transactional(readOnly = true)
public List<Place> findTop3ByOrderByPlaceIdDesc() {
return placeRepository.findTop3ByOrderByPlaceIdDesc();
}
}

0 comments on commit 28c80b0

Please sign in to comment.