-
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
♻️ adjust recipe comment count on change #339
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.
댓글을 등록하면 레시피의 댓글 개수가 증가하고,
댓글을 삭제하면 레시피의 댓글 개수가 감소합니다.
트랜잭션과 테스트 확인 잘 부탁드려요....!!
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.
빠르게 끝냈군요 고생하셨습니다~~
assertThat(commentRepository.count()).isEqualTo(INITIAL_COMMENT_COUNT + 1); | ||
assertAll( | ||
() -> assertThat(commentRepository.count()).isEqualTo(INITIAL_COMMENT_COUNT + 1), | ||
() -> assertThat(recipe.getCommentCount()).isEqualTo(before + 1) |
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.
commentService.createComment()
이후 (댓글 개수가 업데이트된) 레시피를 findbyId(2L)
로 새로 들고와서 비교해야할 것 같아요!
다음 스프린트 때 하시죠! :)
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(commentRepository.count()).isEqualTo(INITIAL_COMMENT_COUNT - 1); | ||
assertAll( | ||
() -> assertThat(commentRepository.count()).isEqualTo(INITIAL_COMMENT_COUNT - 1), | ||
() -> assertThat(recipe.getCommentCount()).isEqualTo(before - 1) |
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.
아토 고생 많으셨습니다! 👍
|
||
Recipe recipe = comment.getRecipe(); | ||
recipe.decreaseCommentCount(); | ||
recipeRepository.save(recipe); |
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.
@Transactional
이 붙어있어서 더티 체킹이 될 것 같습니다.
save를 명시하지 않아도 괜찮을 것 같아요!
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.
그러네요!
빼고 테스트 해보니 잘 동작하네요... ㅎㅎ
지우겠습니다!
|
closes #338
코멘트 확인해주세요~