Skip to content

Commit

Permalink
[feat] 리뷰 월별 조회 쿼리파라미터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed May 29, 2024
1 parent 03c498a commit 00bfece
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public RecordResponse.RecordDetailResponse getRecord(Long userId, String tmdbId)
}
}

public List<List<RecordResponse.RecordCalendarResponse>> getRecordOfCalender(String year, String month) {
public List<List<RecordResponse.RecordCalendarResponse>> getRecordOfCalender(Long userId, String year, String month) {
String start = "01"; String end = "31";
LocalDate startDate = getLocalDate(year, month, start);
LocalDate endDate = getLocalDate(year, month, end);

List<Record> byDateBetween = recordQueryService.findByDateBetween(startDate, endDate);
List<Record> byDateBetween = recordQueryService.findByUserIdAndDateBetween(userId, startDate, endDate);
List<List<RecordResponse.RecordCalendarResponse>> RecordCalendarResponseList = new ArrayList<>(32);
for(int i = 0; i < 32; i++){
RecordCalendarResponseList.add(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface RecordRepository extends JpaRepository<Record, Long> {

Optional<Record> findByUserIdAndMovieId(Long userId, Long movieId);

List<Record> findByDateBetween(LocalDate startDate, LocalDate endDate);
List<Record> findByUserIdAndDateBetween(Long userId, LocalDate startDate, LocalDate endDate);

List<Record> findByUserIdAndUpdatedAtBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public Optional<Record> findByUserIdAndMovieId(Long userId, Long movieId) {
return recordRepository.findByUserIdAndMovieId(userId, movieId);
}

public List<Record> findByDateBetween(LocalDate startDate, LocalDate endDate) {
return recordRepository.findByDateBetween(startDate, endDate);
public List<Record> findByUserIdAndDateBetween(Long userId, LocalDate startDate, LocalDate endDate) {
return recordRepository.findByUserIdAndDateBetween(userId, startDate, endDate);
}

public List<Record> findByUserIdAndUpdatedAtBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void deleteRecord(@RequestParam Long userId, @RequestParam Long movieId)
}

@GetMapping("/record/calendar")
public List<List<RecordResponse.RecordCalendarResponse>> getRecordOfCalender(@RequestParam String year, @RequestParam String month) {
return recordGetService.getRecordOfCalender(year, month);
public List<List<RecordResponse.RecordCalendarResponse>> getRecordOfCalender(@RequestParam Long userId, @RequestParam String year, @RequestParam String month) {
return recordGetService.getRecordOfCalender(userId, year, month);
}

@GetMapping("/record/home/recent/{userId}")
Expand Down

0 comments on commit 00bfece

Please sign in to comment.