-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/65 커뮤니티 댓글 생성 기능 #67
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
Conversation
m-a-king
left a comment
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.
수고하셨습니다. 작업에 가속이 붙으셨네요... 멋져요!
댓글이 삭제된 경우에는 대댓글이 존재할 수 있지만, 댓글이 존재한 흔적이 없다면 그 댓글이 부모가 될 수 없다
라는 검증이 필요할 것 같습니다! 혹시 제가 확인하지 못한걸까요?
| assertThat(savedComment.getParentCommentId()).isNull(); | ||
| } | ||
|
|
||
| @DisplayName("커뮤니티 게시글에 대댓글을 생성할 수 있다. (Repository)") |
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.
| @DisplayName("커뮤니티 게시글에 대댓글을 생성할 수 있다. (Repository)") | |
| @DisplayName("댓글에 대댓글을 생성할 수 있다. (Repository)") |
이런 맥락이 더 좋지 않을까요?
그런 의미에서 parent가 없는 경우에 대한 검증이 여기서나 서비스 테스트에서 필요할 것 같아요!
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.
넵!
board와 comment 파일이 헷갈릴 수 있겠다고 판단하여 폴더로 한 번 더 나누었는데 괜찮은지 여쭤봅니다.
이 부분도 저는 좋은 것 같습니다~
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.
재중님 생각해봤는데
댓글 생성 쪽에서는 삭제된 댓글에는 대댓글 생성을 못하도록 하고
댓글 조회 쪽에서 삭제된 경우에도 대댓글이 있으면 조회를 하도록 해야할 거 같은데
혹시 더 생각해야할 부분이 있을까요?
leebs0521
left a comment
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가 분리되어 있는지 궁금하네요
| @NoArgsConstructor(access = PROTECTED) | ||
| @Entity | ||
| @Table(name = "Community_comment") | ||
| public class CommunityComment extends BaseEntity { |
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.
Community_comment -> community_comment 하시면 좋을 것 같습니다.
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.
앗 수정하겠습니다
| String content | ||
| ) { | ||
| public CommunityComment toEntity(UUID writerId, Long parentCommentId) { | ||
| return CommunityComment.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.
parentCommentId는 어디서 오는지 궁금합니다!
requestDto에 필드에 담겨서 오는게 아닐까요?
아니면 대댓글 작성 API가 따로 있어서 Pathvariable에 담겨오는 걸까요?
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가 분리되어 있는지 궁금하네요
아뇨! 하나예요
requestDto에 담겨서 오는 게 맞네요 (왜 갑자기 이렇게 생각했을까요...)
수정하겠습니다!
* feat: 이미지 업로드 기능 구현 - aws s3 연동을 위한 의존성 추가 - 환경변수 추가 - S3 연결을 위한 config 클래스 구현 - 서비스 레이어에 이미지 업로드 기능 구현 - 업로드 실패 예외와 예외 메세지 추 - test.yml에 테스트에 필요한 환경변수 추가 - 테스트 코드 작성및 검증 완료 * chore: 환경변수 추가 - cicd workflow 에 이미지 업로드 관련 환경변수 추가 - appication.yml에 이미지 업로드 관련 환경변수 이름 변경 * feat: 이미지 파일 검증 기능 구현 - 이미지 크기를 8MB로 제한 - 이미지의 크기 초과를 검증하는 기능 구현 - 이미지의 확장자명을 검증하는 기능 구현 - 이미지 업로드시 검증 기능들을 수행하도록 수정 - 전역 예외처리 핸들러에 이미지 업로드 예외 추가 - 예외 메세지 추가 - 테스트 코드 작성및 검증 완 * fix: 코드 리뷰 사항 반영 - BASE_URL을 S3_BASE_URL라는 더 명시적인 이름으로 변경 - ImageUploadUtils private 생성자의 예외처리 메세지를 ExceptionMessage에 등록하여 사용하도록 수정 - 이미지 업로드 메서드의 내부 기능을 메서드로 추출하여 가독성 향상 - ImageUploadUtils의 일부 기능의 접근 제어자를 private으로 수정 - 테스트 코드의 when, then을 더 명확하게 분
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| class CreateCommunityCommentServiceTest extends IntegrationTestSupport { |
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.
삭제된 댓글에는 대댓글을 달지 못하는 게 맞는 거 같아요.
그 부분 추가했습니다!
- repository 테스트에 findById 테스트 추가 - service 테스트에 대댓글 예외 테스트 추가
- parentCommentId Dto 필드로 수정
|
|
||
| @DisplayName("삭제된 댓글에 대댓글을 등록할 때 예외를 던진다.") | ||
| @Test | ||
| void createCommunityCommentRelyWithDeletedParentId() { |
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.
Rely -> Reply 오타 있어요~
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.
와우 수정했습니다
| if (communityComment.getParentCommentId() != null) { | ||
| communityCommentRepository.findById(communityComment.getParentCommentId()) | ||
| .orElseThrow(() -> new BadRequestException(NOT_EXISTS_COMMUNITY_COMMENT.getMessage())); | ||
| } |
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 메서드로 추출할 수 있을 것 같습니다.
| if (communityComment.getParentCommentId() != null) { | |
| communityCommentRepository.findById(communityComment.getParentCommentId()) | |
| .orElseThrow(() -> new BadRequestException(NOT_EXISTS_COMMUNITY_COMMENT.getMessage())); | |
| } | |
| �checkParentComment(communityComment.getParentCommentId()); |
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.
수정했습니다!
| assertThat(communityCommentReply.get().getParentCommentId()).isEqualTo(commentId); | ||
| } | ||
|
|
||
| @DisplayName("삭제된 댓글에 대댓글을 등록할 때 예외를 던진다.") |
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.
좋습니다
m-a-king
left a comment
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.
신경 써야 할 검증이 너무 많고 선택적이네요. 수고가 많으십니다.
다음에 댓글, 대댓글 �기능이 완성되고 다시 확인해 보고 싶습니다!
- ServiceTest 오타 수정 - validateParentCommentExists 메서드 추출
- repository 테스트에 findById 테스트 추가 - service 테스트에 대댓글 예외 테스트 추가
- parentCommentId Dto 필드로 수정
- ServiceTest 오타 수정 - validateParentCommentExists 메서드 추출
…-create' into feature/65-add-community-comment-create
|
|
꼼꼼히 체크해주신것 같습니다 고생하셨어요. |



resolved :
📌 과제 설명
👩💻 요구 사항과 구현 내용
✅ PR 포인트 & 궁금한 점