-
Notifications
You must be signed in to change notification settings - Fork 7
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
모임 댓글 기능 구현 #169
모임 댓글 기능 구현 #169
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.
수고했어요 아연씨 ~
리뷰 가볍게 체크 부탁드려요 😋
@JoinColumn(name = "moim_id") | ||
private Moim moim; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; |
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.
이거는 @Column(nullable = false)
를 안해줘도 되나요?
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.
필요한 것 같아요@ManyToOne
가 있어 @JoinColum(nullable = false)
로 하겠습니다~!
} | ||
|
||
private void validateContent(String content) { | ||
if (content == null || content.isBlank()) { |
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.
content.isBlank()
에 null check가 포함되어있는 걸로 아는데요 😁
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.
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.
헤헷콩 감사합니다
private void validateMoim(Moim moim) { | ||
if (moim == null) { | ||
throw new MoimException(HttpStatus.NOT_FOUND, MoimErrorMessage.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.
댓글 저장 시 잘못된 모임을 입력해서 에러가 발생했는데, MoimException
을 발생시키는 게 적절할까요? 고민해봅시다!
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | ||
LocalDateTime dateTime |
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.
데이터베이스에서는 date
time
으로 따로 저장되어있는데
여기는 한번에 보내네요! 이유가 있을까요?
LocalDateTime으로 보내면 상돌이 설정한 JacksonConfig가 적용되지 않는군요 .. 한번에 JacksonConfig에서 포맷팅할 수 없을까요?
|
||
private void validateMember(Member member) { | ||
if (member == null) { | ||
throw new CommentException(HttpStatus.NOT_FOUND, CommentErrorMessage.MEMBER_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.
여기에서는 회원이 없을 때 CommentException이 발생하는데, 위와 컨벤션이 맞지 않는 것 같네요.
List<Comment> comments = commentRepository.findAllByMoimIdOrderByCreatedAt(id); | ||
Map<Long, List<Comment>> childComments = comments.stream() | ||
.filter(Comment::isChild) | ||
.collect(groupingBy(Comment::getParentId)); | ||
|
||
List<CommentResponse> commentResponses = comments.stream() | ||
.filter(Comment::isParent) | ||
.map(comment -> CommentResponse.toResponse(comment, findChildComments(comment, childComments))) | ||
.toList(); |
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.
이 부분이 무슨 역할을 담당하는 지 이해하기 힘든 것 같아요. 메서드 분리해서 가독성을 높여주면 좋겠어용
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.
나중에 테스트 픽스처를 사용하는 것으로 수정해주면 좋겠어요!
다른 도메인들도 픽스처를 사용하기로 해서요.
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.
오잉 픽스처가 있네요 .. 😀
왜 하나만 생성해두었는 지 궁금하네요 👍
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.
null 같은 값이 부분적으로 들어가야해서 픽스쳐 사용하지 않았어용 픽스쳐는 자식 댓글 하나 추가할게용
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.
간단한 코멘트니까 넘어가도 돼요!
@Column(nullable = false) | ||
private String content; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "moim_id") | ||
private Moim moim; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@Column(nullable = false) | ||
private LocalDateTime createdAt; | ||
|
||
private Long parentId; |
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.
널이 가능한 컬럼과 아닌 컬럼이 나뉘어 있는데 제가 볼 때는 모든 정보다 다 null 이면 안되는 값 같아보여서요!
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | ||
LocalDateTime dateTime, | ||
|
||
List<ChildCommentResponse> childs |
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.
ㅋㅋ? child의 복수형은 children 아닌가요?
|
||
public Moim createMoim(MoimCreateRequest moimCreateRequest) { | ||
Member author = new Member(moimCreateRequest.authorNickname()); | ||
Moim moim = moimRepository.save(moimCreateRequest.toEntity()); |
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.
builder 로 생성하지 않고 생성자를 선택하신 이유가 있나요?
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.
오호라
|
||
public record CommentCreateRequest( | ||
Long parentId, | ||
|
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.
파라미터 요거 개행하나요?
|
||
@Override | ||
@PostMapping("/{moimId}") | ||
public ResponseEntity<Void> createComment(@LoginMember Member member, @PathVariable Long moimId, |
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.
파라미터 3개 이상이면 줄바꿈 해야할 것 같습니다! 컨벤션에 적혀있더라구요!
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.
감삼당 👍
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.
고생많았습니다 테니! 코드량이 쫌 많긴 하네요!
사소한 컨벤션 몇개 남겨놨습니다!
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.
피드백 잘 반영해주셔서 감사합니다><
어푸르브 드려요 ><
PR의 목적이 무엇인가요?
모임 댓글 기능을 구현합니다.
이슈 ID는 무엇인가요?
설명
질문 혹은 공유 사항 (Optional)