Skip to content

Commit

Permalink
✨ Feat: 브리핑 목록 조회 v1 쿼리 전략 변경 (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
swa07016 authored Dec 14, 2023
1 parent 867306a commit c855efe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
import briefing.briefing.application.context.BriefingQueryContext;
import briefing.briefing.application.context.BriefingQueryContextFactory;
import briefing.briefing.application.dto.BriefingRequestParam;
import briefing.briefing.application.strategy.BriefingV1QueryStrategy;
import briefing.briefing.domain.Briefing;
import briefing.briefing.domain.repository.BriefingRepository;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

import briefing.common.enums.APIVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import briefing.briefing.application.dto.BriefingRequestParam;
import briefing.briefing.domain.Briefing;
import briefing.briefing.domain.BriefingType;
import briefing.briefing.domain.repository.BriefingRepository;
import lombok.RequiredArgsConstructor;

Expand All @@ -20,8 +21,9 @@ public List<Briefing> findBriefings(BriefingRequestParam.BriefingPreviewListPara
final LocalDateTime startDateTime = params.getDate().atStartOfDay();
final LocalDateTime endDateTime = params.getDate().atTime(LocalTime.MAX);

return briefingRepository.findAllByTypeAndCreatedAtBetweenOrderByRanks(
params.getType(), startDateTime, endDateTime);
List<Briefing> briefingList = briefingRepository.findAllByTypeAndCreatedAtBetweenOrderByRanks(params.getType(), startDateTime, endDateTime);
if(briefingList.isEmpty()) return briefingRepository.findTop10ByTypeOrderByCreatedAtDesc(BriefingType.SOCIAL);
return briefingList;
}

@Override
Expand Down

0 comments on commit c855efe

Please sign in to comment.