-
Notifications
You must be signed in to change notification settings - Fork 0
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
3주차 과제 #6
base: main
Are you sure you want to change the base?
3주차 과제 #6
Conversation
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.
좋아여! 깔끔해여! dto 에서 정적 팩토리 메서드 사용 배우고 갑니당..
@@ -11,6 +12,7 @@ | |||
@EntityListeners(AuditingEntityListener.class) //해당 어노테이션은 엔티티의 변화를 감지하여 엔티티와 매핑된 테이블의 데이터를 조작 |
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.
자동으로 시간을 넣어주기 위해서 넣은걸까용
@PostMapping("/diary") | ||
ResponseEntity<Void> postDiary(@RequestHeader("userId") final Long userId, | ||
@RequestBody final DiaryPostReq diaryPostReq) { | ||
ValidatorUtil.validStringLength(diaryPostReq.content(), Constants.MAX_CONTENT_LENGTH); |
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.
검증을 이렇게 하니까 더 가독성이 좋아보여요
}; | ||
} | ||
|
||
//빈 List 검증 |
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.
이것두 다른 메서드처럼 분리해도 좋을 것같은데!
|
||
//개인 일기 목록 조회 API | ||
@GetMapping("/diaries/my") | ||
ResponseEntity<DiaryMyListRes> getMyDiaryList(@RequestHeader("userId") final Long userId, |
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.
만약에 userId가 null 이 들어오면 어떻게 처리가 되나요...? 컨트롤러단에서 처리를 해줘야하지 않나해서..
private Long id; | ||
|
||
@JoinColumn(name = "user_id") | ||
@ManyToOne(fetch = FetchType.LAZY) |
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.
연관 안맺는게 좋다구 들었던거같은데... 혹시 연관 관계 맺으신 이유가 따로있을까여?
No description provided.