Skip to content

Commit

Permalink
Merge pull request #128 from Team-Shaka/feature/127
Browse files Browse the repository at this point in the history
✨  Feat: 브리핑 목록 조회 V2 방어적 작성
  • Loading branch information
swa07016 authored Dec 27, 2023
2 parents f20e618 + e68c055 commit 5115283
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand All @@ -21,15 +22,17 @@ public class BriefingV2QueryStrategy implements BriefingQueryStrategy{

@Override
public List<Briefing> findBriefings(BriefingRequestParam.BriefingPreviewListParam params) {
List<Briefing> briefingList;
if(params.isPresentDate()) {
final LocalDateTime startDateTime = params.getDate().atStartOfDay();
final LocalDateTime endDateTime = params.getDate().atTime(LocalTime.MAX);

return briefingRepository.findBriefingsWithScrapCount(
briefingList = briefingRepository.findBriefingsWithScrapCount(
params.getType(), startDateTime, endDateTime, params.getTimeOfDay());
if(!briefingList.isEmpty()) return briefingList;
}

List<Briefing> briefingList = briefingRepository.findTop10ByTypeOrderByCreatedAtDesc(params.getType());
briefingList = briefingRepository.findTop10ByTypeOrderByCreatedAtDesc(params.getType());
Collections.reverse(briefingList);
return briefingList;
}
Expand Down

0 comments on commit 5115283

Please sign in to comment.