-
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
feat(like) : 좋아요 기능 개발 #37
Conversation
public void createLike(Long qnAId, User user) { | ||
QnA qnA = qnAReader.read(qnAId); | ||
likeValidator.shouldBeAlreadyLike(qnA, user); | ||
likeCreator.create(new Like(user, qnA)); | ||
} | ||
|
||
public void deleteLike(Long qnAId, User user) { | ||
QnA qnA = qnAReader.read(qnAId); | ||
Like like = likeReader.read(qnA, user); | ||
likeDeleter.delete(like); | ||
} |
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.
LikeService니 함수이름을 creatLike로 하는 것 보다 create와 같이 작성하는게 간결해보입니다!
public void shouldBeAlreadyLike(QnA qnA, User user) { | ||
boolean isExist = likeRepository.existsByQnAAndUser(qnA, user); | ||
|
||
if (isExist) { | ||
throw new AlreadyLikeException(); | ||
} | ||
} |
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.
shouldBeAlreadyLike라는 함수 이름이 잘못된 것 같아요. 이 메서드는 좋아요가 이미 눌러져있다면 오류를 발행하는 함수이기 때문에 shouldNotExistLike 와 같은 이름이 적합해보입니다!
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.
깔끼하네요 ㄷㄷ
🎫 관련 이슈
close #36
📄 개요
🔨 작업 내용
🏁 확인 사항
🙋🏻 덧붙일 말