-
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주차 심화과제 #5
base: #3
Are you sure you want to change the base?
3주차 심화과제 #5
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.
잘 봤습니다!
try { | ||
return ApiResponseDto.success(SuccessStatus.CREATE_POST_SUCCESS, postService.createPost(request)); | ||
} catch (UserNotFoundException e) { | ||
return ApiResponseDto.error(ErrorStatus.USER_NOT_FOUND); |
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.
혹시 이 에러 상황일 때 http 응답코드가 어떻게 반환되나요? @ResponseStatus(HttpStatus.CREATED)가 있어도 응답코드가 404로 나올지 궁금합니다!
@Builder | ||
public User(String nickname, String email, String password) { | ||
this.nickname = nickname; | ||
this.email = email; | ||
this.password = password; | ||
} | ||
|
||
//mappedBy 양방향 연관관계 주인 user x -> post(외래키를 가진 쪽) | ||
@OneToMany(mappedBy = "user") //일대다(1:N) | ||
private final List<Post> posts = new ArrayList<>(); |
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.
user를 가지고 post에 접근할 일이 없다면 양방향으로 설정하지 않아도 될 것 같아요!
✅ 과제 구현 명세
controller에서 catch하여 처리하도록 구현했습니다.
😊 이런 점이 새로웠어요 / 어려웠어요