Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Mojacknong/Farmus-Spring int…
Browse files Browse the repository at this point in the history
…o fix_47'/메인-루틴-조회
  • Loading branch information
Ryeolee committed Jul 31, 2024
2 parents c4a2a0c + 14d694f commit 1e27c33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public BaseResponseDto<CheckTodayDiaryResponse> checkTodayDiary(
}

@GetMapping(value = "/{myVeggieId}/one")
public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(
@PathVariable("myVeggieId") Long myVeggieId
) {
public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(@PathVariable("myVeggieId") Long myVeggieId) {
return myVeggieDiaryService.selectDiaryOne(MyVeggie.builder().id(myVeggieId).build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public interface DiaryRepository extends JpaRepository<Diary, Long> {
)
List<Diary> findDiaryByFarmClub(@Param("farmClubId") Long farmClubId);

@Query("SELECT d FROM diary AS d WHERE d.myVeggie = :myVeggie AND FUNCTION('DATE', d.createdDate) = CURRENT_DATE")
List<Diary> findDiaryByToday(@Param("myVeggie") MyVeggie myVeggie);



}
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ public void updateComment(User user, Long diaryCommentId, String content) {
myVeggieRepository.updateDiaryCommentByIdAndUserId(diaryCommentId, user, content);
}
@Transactional
public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(
MyVeggie myVeggie
) {
List<Diary> diaryList = selectDiaryByMyVeggie(myVeggie);
public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(MyVeggie myVeggie) {
List<Diary> diaryList = diaryRepository.findDiaryByToday(myVeggie);
if(diaryList.isEmpty()) {
return BaseResponseDto.of(MyVeggieGardenSuccessCode.NOT_FOUND_DIARY, null);
}
Expand Down

0 comments on commit 1e27c33

Please sign in to comment.