Skip to content

Commit

Permalink
[fix] 메인페이지 루틴 조회 시 조건 추가 -> 오늘 해야할 루틴
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryeolee committed Jul 30, 2024
1 parent f2869e7 commit c4a2a0c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public BaseResponseDto<?> checkVeggieRoutine(@Validated @RequestBody RoutineChec
}

@GetMapping(value = "/{myVeggieId}")
public BaseResponseDto<?> selectMyVeggieRoutineById(
@PathVariable("myVeggieId") Long myVeggieId
) {
public BaseResponseDto<?> selectRoutineToday(@PathVariable("myVeggieId") Long myVeggieId) {
MyVeggie myVeggie = MyVeggie.builder().id(myVeggieId).build();
List<MyVeggieRoutine> result = myVeggieRoutineService.selectMyVeggieRoutineById(myVeggie);
return BaseResponseDto.of(SuccessCode.SUCCESS, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ public interface RoutineRepository extends JpaRepository<Routine, Long> {
"FUNCTION('YEAR', r.date) = FUNCTION('YEAR', :month) AND FUNCTION('MONTH', r.date) = FUNCTION('MONTH', :month)")
List<Routine> findRoutineAndRoutineAndMyVeggieByMonthWithUser(@Param("month") Date month, @Param("user") User user );


@Query("SELECT r FROM routine AS r WHERE r.myVeggie = :myVeggie AND r.date = CURRENT_DATE")
List<Routine> findRoutineByIdAndToday(@Param("myVeggie") MyVeggie myVeggie);
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void eraseRoutine(RoutineDelete routineDelete) {

@Transactional
public List<MyVeggieRoutine> selectMyVeggieRoutineById(MyVeggie myVeggie) {
List<Routine> routineList = myVeggieRepository.findMyVeggieRoutineById(myVeggie);
List<Routine> routineList = routineRepository.findRoutineByIdAndToday(myVeggie);
return MyVeggieRoutine.processData(routineList);
}

Expand Down

0 comments on commit c4a2a0c

Please sign in to comment.