Skip to content

Commit

Permalink
[#198] fix(PerformanceService): getPerformanceDetail readOnly 설정 변경 및…
Browse files Browse the repository at this point in the history
… 불필요한 주석 제거
  • Loading branch information
hyerinhwang-sailin committed Aug 29, 2024
1 parent 29fb7a9 commit 3021685
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class PerformanceService {
private final BookingRepository bookingRepository;
private final PerformanceImageRepository performanceImageRepository;

@Transactional(readOnly = true)
@Transactional
public PerformanceDetailResponse getPerformanceDetail(Long performanceId) {
Performance performance = performanceRepository.findById(performanceId)
.orElseThrow(() -> new NotFoundException(PerformanceErrorCode.PERFORMANCE_NOT_FOUND));
Expand Down Expand Up @@ -197,7 +197,6 @@ public HomeResponse getHomePerformanceList(HomeRequest homeRequest) {
})
.collect(Collectors.toList());

// 두 개의 스트림을 각각 처리하여 병합
List<HomePerformanceDetail> positiveDueDates = performanceDetails.stream()
.filter(detail -> detail.dueDate() >= 0)
.sorted((p1, p2) -> Integer.compare(p1.dueDate(), p2.dueDate()))
Expand All @@ -208,7 +207,6 @@ public HomeResponse getHomePerformanceList(HomeRequest homeRequest) {
.sorted((p1, p2) -> Integer.compare(p2.dueDate(), p1.dueDate()))
.collect(Collectors.toList());

// 병합된 리스트
positiveDueDates.addAll(negativeDueDates);

List<HomePromotionDetail> promotions = getPromotions();
Expand Down Expand Up @@ -261,19 +259,16 @@ public MakerPerformanceResponse getMemberPerformances(Long memberId) {
})
.collect(Collectors.toList());

// 양수 minDueDate 정렬
List<MakerPerformanceDetailResponse> positiveDueDates = performanceDetails.stream()
.filter(detail -> detail.minDueDate() >= 0)
.sorted(Comparator.comparingInt(MakerPerformanceDetailResponse::minDueDate))
.collect(Collectors.toList());

// 음수 minDueDate 정렬
List<MakerPerformanceDetailResponse> negativeDueDates = performanceDetails.stream()
.filter(detail -> detail.minDueDate() < 0)
.sorted(Comparator.comparingInt(MakerPerformanceDetailResponse::minDueDate).reversed())
.collect(Collectors.toList());

// 병합된 리스트
positiveDueDates.addAll(negativeDueDates);

return MakerPerformanceResponse.of(user.getId(), positiveDueDates);
Expand Down

0 comments on commit 3021685

Please sign in to comment.