-
Notifications
You must be signed in to change notification settings - Fork 0
fix: AI & Schedule #20
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
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,47 +12,38 @@ | |
|
|
||
| @Repository | ||
| public interface ScheduleRepository extends JpaRepository<Schedule, Long> { | ||
|
|
||
| @Query("SELECT s FROM Schedule s WHERE s.user = :user " + | ||
| "AND ((s.startDate >= :startDate AND s.startDate < :endDate) " + | ||
| "OR (s.endDate > :startDate AND s.endDate <= :endDate) " + | ||
|
|
||
| /** | ||
| * 사용자의 모든 일정을 반복 설정과 함께 조회 (Fetch Join으로 N+1 방지) | ||
| */ | ||
| @Query("SELECT DISTINCT s FROM Schedule s " + | ||
| "LEFT JOIN FETCH s.scheduleRepeat " + | ||
| "WHERE s.user = :user " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findAllByUserWithRepeat(@Param("user") User user); | ||
|
|
||
| /** | ||
| * 특정 기간 내 일정을 반복 설정과 함께 조회 | ||
| */ | ||
| @Query("SELECT DISTINCT s FROM Schedule s " + | ||
| "LEFT JOIN FETCH s.scheduleRepeat " + | ||
| "WHERE s.user = :user " + | ||
| "AND ((s.startDate >= :startDate AND s.startDate <= :endDate) " + | ||
| "OR (s.endDate >= :startDate AND s.endDate <= :endDate) " + | ||
| "OR (s.startDate <= :startDate AND s.endDate >= :endDate)) " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findByUserAndDateRange(@Param("user") User user, | ||
| @Param("startDate") LocalDateTime startDate, | ||
| @Param("endDate") LocalDateTime endDate); | ||
|
|
||
| @Query("SELECT s FROM Schedule s WHERE s.user = :user " + | ||
| List<Schedule> findByUserAndDateRangeWithRepeat(@Param("user") User user, | ||
| @Param("startDate") LocalDateTime startDate, | ||
| @Param("endDate") LocalDateTime endDate); | ||
|
|
||
| /** | ||
| * 현재 시점 이후의 예정된 일정 조회 (반복 설정 포함) | ||
| */ | ||
| @Query("SELECT DISTINCT s FROM Schedule s " + | ||
| "LEFT JOIN FETCH s.scheduleRepeat " + | ||
| "WHERE s.user = :user " + | ||
| "AND s.startDate >= :now " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findUpcomingSchedules(@Param("user") User user, | ||
| @Param("now") LocalDateTime now); | ||
|
|
||
| List<Schedule> findByUserOrderByStartDateDesc(User user); | ||
|
|
||
| @Query("SELECT s FROM Schedule s WHERE s.user = :user " + | ||
| "AND DATE(s.startDate) = :date " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findByUserAndDate(@Param("user") User user, | ||
| @Param("date") LocalDateTime date); | ||
|
|
||
| @Query("SELECT s FROM Schedule s WHERE s.user = :user " + | ||
| "AND s.startDate >= :startOfWeek AND s.startDate < :endOfWeek " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findByUserAndWeek(@Param("user") User user, | ||
| @Param("startOfWeek") LocalDateTime startOfWeek, | ||
| @Param("endOfWeek") LocalDateTime endOfWeek); | ||
|
|
||
| @Query("SELECT DATE(s.startDate) as date, COUNT(s) as count " + | ||
| "FROM Schedule s WHERE s.user = :user " + | ||
| "AND s.startDate >= :startDate AND s.startDate < :endDate " + | ||
| "GROUP BY DATE(s.startDate)") | ||
| List<Object[]> findScheduleCountsByDate(@Param("user") User user, | ||
| @Param("startDate") LocalDateTime startDate, | ||
| @Param("endDate") LocalDateTime endDate); | ||
|
|
||
| @Query("SELECT s FROM Schedule s WHERE s.user = :user " + | ||
| "AND DATE(s.startDate) = CURRENT_DATE " + | ||
| "ORDER BY s.startDate ASC") | ||
| List<Schedule> findTodaySchedules(@Param("user") User user); | ||
| List<Schedule> findUpcomingSchedulesWithRepeat(@Param("user") User user, | ||
| @Param("now") LocalDateTime now); | ||
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
findByUserAndDateRangeWithRepeatmethod is defined but never used in the service layer. The service now usesfindAllByUserWithRepeatand filters in memory instead. Consider either removing this unused method or documenting why it's kept for future use.