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

♻️ adjust recipe comment count on change #339

Merged
merged 4 commits into from
Aug 22, 2024
Merged

♻️ adjust recipe comment count on change #339

merged 4 commits into from
Aug 22, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 22, 2024

closes #338

코멘트 확인해주세요~

@github-actions github-actions bot added BE Backend ♻️ refactor refactor labels Aug 22, 2024
@hyxrxn hyxrxn linked an issue Aug 22, 2024 that may be closed by this pull request
@hyxrxn hyxrxn changed the title ♻️ increment recipe comment count on add ♻️ adjust recipe comment count on change Aug 22, 2024
Copy link
Contributor Author

Overall Project 92.89% 🍏
Files changed 100% 🍏

File Coverage
CommentService.java 96.45% 🍏
Recipe.java 83.33% 🍏

Copy link
Contributor

@hyxrxn hyxrxn left a comment

Choose a reason for hiding this comment

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

댓글을 등록하면 레시피의 댓글 개수가 증가하고,
댓글을 삭제하면 레시피의 댓글 개수가 감소합니다.

트랜잭션과 테스트 확인 잘 부탁드려요....!!

@hyxrxn hyxrxn requested review from geoje and tackyu August 22, 2024 05:41
Copy link

@oshyun00 oshyun00 left a comment

Choose a reason for hiding this comment

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

확인했습니다! 고생하셨습니다.

Copy link
Contributor

@geoje geoje left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

commentService.createComment() 이후 (댓글 개수가 업데이트된) 레시피를 findbyId(2L) 로 새로 들고와서 비교해야할 것 같아요!
다음 스프린트 때 하시죠! :)

Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

여기두...!

Copy link
Contributor Author

Overall Project 92.89% 🍏
Files changed 100% 🍏

File Coverage
CommentService.java 96.45% 🍏
Recipe.java 83.33% 🍏

Copy link
Contributor

@tackyu tackyu left a 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);
Copy link
Contributor

@tackyu tackyu Aug 22, 2024

Choose a reason for hiding this comment

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

@Transactional이 붙어있어서 더티 체킹이 될 것 같습니다.
save를 명시하지 않아도 괜찮을 것 같아요!

Copy link
Contributor

Choose a reason for hiding this comment

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

그러네요!
빼고 테스트 해보니 잘 동작하네요... ㅎㅎ
지우겠습니다!

Copy link
Contributor Author

Overall Project 92.88% 🍏
Files changed 100% 🍏

File Coverage
CommentService.java 96.18% 🍏
Recipe.java 83.33% 🍏

@hyxrxn hyxrxn merged commit 05796da into be/dev Aug 22, 2024
1 check passed
@hyxrxn hyxrxn deleted the be/feat/338 branch August 22, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE Backend ♻️ refactor refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

♻️ adjust recipe comment count on change
4 participants