Skip to content

Commit

Permalink
Merge pull request #37 from lsn5963/feat/quest
Browse files Browse the repository at this point in the history
[FIX] userRepository로 가져오게 수정하기
  • Loading branch information
lsn5963 authored Aug 15, 2024
2 parents 866580d + 06576dc commit 74b7af0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public class CalendarService {
private final QuestRepository questRepository;

public ResponseEntity<?> retrieveCalendar(YearMonth date, UserPrincipal userPrincipal) {
Character character = characterRepository.findByUserId(userPrincipal.getId()).orElseThrow(() -> new IllegalArgumentException("캐릭터를 찾을 수 없습니다."));

LocalDate startDate = date.atDay(1);
LocalDate endDate = date.atEndOfMonth();

//그 달의 첫날부터 마지막날까지의 경험치들 가져오기
List<DailyExperience> calendarList = dailyExperienceRepository.findByCharacterIdAndDateBetweenOrderByDateAsc(userPrincipal.getId(), startDate, endDate);
List<DailyExperience> calendarList = dailyExperienceRepository.findByCharacterIdAndDateBetweenOrderByDateAsc(character.getId(), startDate, endDate);

List<RetrieveCalendarRes> calendarRes = calendarList.stream().
map(calendar -> RetrieveCalendarRes.builder()
Expand Down

0 comments on commit 74b7af0

Please sign in to comment.