Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Feat: 브리핑 목록 조회 V2 방어적 작성 #128

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading