Skip to content
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

[FEAT] 답변 공감 기능 #31

Merged
merged 7 commits into from
Mar 18, 2024
Merged

[FEAT] 답변 공감 기능 #31

merged 7 commits into from
Mar 18, 2024

Conversation

PgmJun
Copy link
Member

@PgmJun PgmJun commented Mar 3, 2024

✒️ 관련 이슈번호

🔑 Key Changes

  1. 답변 공감 기능
  2. 답변 공감 취소 기능

📸 Screenshot

📢 To Reviewers

  • 이미 공감된 답변에 또다시 공감 API를 보내면 Conflict가 발생하도록 구현하였습니다.
  • 이미 공감 취소된 답변에 또다시 공감 취소 API를 보내면 NotFound가 발생하도록 구현하였습니다.
  • [FEAT] 질문에 대한 답변 조회 #28 에서 개발한 Like 엔티티가 필요해서 feat/[FEAT] 질문에 대한 답변 조회 #28 브랜치에서 새로운 브랜치를 뻗어 개발하였습니다 때문에 feat/[FEAT] 질문에 대한 답변 조회 #28 브랜치의 커밋이 섞여있는데, 이 부분 감안하여 #29가 붙은 커밋에 리뷰 부탁드립니다
  • 노션에 에러코드 재정리가 필요해보입니다. 개발 끝나고 정리한번 해야할 것 같습니다

중복 공감 시, Conflict 발생하는 기능도 구현 완료
@PgmJun PgmJun added the ✨ Feat 기능 개발 label Mar 3, 2024
@PgmJun PgmJun self-assigned this Mar 3, 2024
Comment on lines 29 to 30
answerService.likeAnswerById(memberId, answerId)
return ApiResponse.success()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

서비스 메서드 네이밍 수정하면 좋을 것 같아요. byId 만 봤을 때는 파라미터로 하나의 id 만 들어가는 것처럼 보일 수 있을 것 같아요. createLike 와 같은 네이밍은 어떨지 의견 남겨봅니당

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createLike로 변경하겠습니다!

Comment on lines 37 to 38
answerService.dislikeAnswerById(memberId, answerId)
return ApiResponse.success()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 같은 맥락으로 네이밍 한번 고려해봐주세요~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createLike / deleteLike 어떨까요?-?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteLike좋습니다 ! 변경해썽요:)

Comment on lines 37 to 38
answerService.dislikeAnswerById(memberId, answerId)
return ApiResponse.success()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createLike / deleteLike 어떨까요?-?

}

@Auth
@Operation(summary = "[인증] 답변 공감")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기두 명세서와 같이 [인증] 질문 답변 공감 이렇게 바꿔주면 좋을 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

질문 답변 공감이라는 단어가 약간 애매해서 답변 공감으로 했는데요 제가 톡방에 올려보겠습니다

}

@Auth
@Operation(summary = "[인증] 답변 공감 취소")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 명세서와 동일하게 바꾸는 건 어떨지 고려해봐주세요!

Comment on lines +17 to +18
return likeRepository.findLikeByMemberAndAnswerAndQuestion(member = member, answer = answer, question = question)
?: throw NotFoundException(ErrorCode.NOT_FOUND_LIKE_EXCEPTION, "존재하지 않는 공감 입니다")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validator로 옮겨서 처리해주는건 어떨까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 그래야 할 것 같네용 감사합니다~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validator로 옮겨서 처리해주는건 어떨까요?

근데 다른 Explorer 로직 확인하면 조회에서 NotFound 체크해주고
Validator는 특정 검증작업이 필요한 경우에만 사용되는 거 같습니다.

조회기능에서 사용되는 NotFound 검증 책임을 Validator로 위임하면 똑같은 조회 쿼리가 2번 발생하게 됩니다.
NotFound 처리는 Explorer에 두는 거 어떠신가요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋아요!

Comment on lines 13 to 15
fun findQuestionById(id: Long): Question {
return questionRepository.findQuestionById(id)
?: throw NotFoundException(ErrorCode.NOT_FOUND_QUESTION_EXCEPTION, "존재하지 않는 질문(ID: $id) 입니다")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 한번 고려해봐주세요!

Copy link
Member Author

@PgmJun PgmJun Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에 답변 내용 부탁드립니다!

@PgmJun PgmJun merged commit 12cdc0d into develop Mar 18, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feat 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 답변 공감 기능
3 participants