Skip to content

Commit

Permalink
Fix: 순환참조 오류수정
Browse files Browse the repository at this point in the history
Tag 엔티티 직접 가져오려니 데이터 더 추가시 순환 참조 오류 발생 우려있어서
TagDTO 추가해서 해결, 엔티티 객체 직접 참조 안함
  • Loading branch information
Mouon committed Jan 21, 2024
1 parent 191e344 commit 9d9641e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public DiaryInquiryController(DiaryInquiryService diaryInquiryService){

@GetMapping("/get-monthly-diary")
public ResponseEntity<List<DiaryInquiryResponse>> getMonthlyDiaryList(@RequestParam("user_id") Long user_id,
@RequestParam("year") int year,
@RequestParam("month") int month){
@RequestParam("year") int year, @RequestParam("month") int month){
List<DiaryInquiryResponse> monthlyEvents = diaryInquiryService.getMonthlyDiaryPhotos(user_id,year,month);
return ResponseEntity.ok(monthlyEvents);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/kuit/chatdiary/dto/TagInfoDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
public class TagInfoDTO {
private Long tagId;
private String tagName;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class DiaryInquiryResponse {
private Date diaryDate;
private List<TagInfoDTO> tagList;
private List<String> photoList;

@Builder
public DiaryInquiryResponse(Diary diary){
this.diaryId = diary.getDiaryId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public List<DiaryInquiryResponse> inquiryDiaryRange(Long userId, Date startDate,
.setParameter("startDate", startDate, TemporalType.DATE)
.setParameter("endDate", endDate,TemporalType.DATE)
.getResultList();

return diaries.stream()
.map(DiaryInquiryResponse::new)
.collect(Collectors.toList());
Expand Down

0 comments on commit 9d9641e

Please sign in to comment.