Skip to content

Commit

Permalink
Fix : 일기 재작성 검사 범위 수정 (#196)
Browse files Browse the repository at this point in the history
* Feat(infra) : 10분단위 스케줄링 구현

Spring Scheduler + Cron tab을 이용하여 구현하였습니다.

* Feat : 테스트 및 시간 고정을 위한 Clock 객체 주입

* Test : 스케줄러 단위테스트

* Feat : Service 시간 주입 방식 변경

* Fix : Schedule 객체 사소한 수정

* Fix : Message Processing Time

* HotFIx : 알림 시간 조정

* Feat : Reply Response Spec 변경

Boolean isRead = true/false 를 추가 반환합니다.

* Test : ReplyStatus 단위테스트

* Hotfix : 일기 작성 알림 메세지 수정

* Fix(domain) : Reply 조회 시 읽기 여부 값 반환 로직 수정

* Chore : Todo

* Fix : 탐색 시간 수정
  • Loading branch information
hyunw9 authored Sep 6, 2024
1 parent 2ea02e4 commit bf78932
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand All @@ -38,13 +39,13 @@ public DiaryDomainInfo createDiary(List<String> diaryContents) {
User user = userRepository.findById(userId);
LocalDateTime now = LocalDateTime.now();

LocalDateTime start = LocalDateTime.of(now.getYear(), now.getMonth(), 1, 0, 0);
LocalDateTime end = start.plusMonths(1);
LocalDateTime start = LocalDateTime.of(now.getYear(), now.getMonthValue(), 0,0,0);
LocalDateTime endOfDay = start.plusDays(1);

// isDeleted 가 true 인 일기가 있으면
List<Diary> unDeletedDiaries = diaryRepository.findDiariesByUserIdAndCreatedAtBetween(userId, start, end).stream()
List<Diary> unDeletedDiaries = diaryRepository.findDiariesByUserIdAndCreatedAtBetween(userId, start, endOfDay).stream()
.filter(diary -> !diary.isDeleted())
.toList();
.collect(Collectors.toUnmodifiableList());
if (!unDeletedDiaries.isEmpty()){
throw new DiaryCreateException(ErrorType.EXCESS_DIARY_CREATE);
}
Expand Down

0 comments on commit bf78932

Please sign in to comment.