Conversation
Summary of ChangesHello @JayongLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 블로그 게시물의 조회수 기능을 도입하고, 사용자가 동일한 게시물을 여러 번 조회해도 조회수가 중복으로 증가하지 않도록 쿠키 기반의 방지 로직을 구현합니다. 이를 통해 블로그 게시물의 인기도를 정확하게 측정하고, 사용자 경험을 개선하는 데 기여합니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
src/main/java/dev/woori/woorilog/domain/blog/repository/BlogRepository.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/service/BlogService.java
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a view count feature for blog posts, including logic to prevent duplicate view increases using cookies. The changes involve adding a viewCount field to the Blog entity and related DTOs, updating the BlogRepository with a method to increment the view count, and implementing cookie-based logic in the BlogService to track and prevent duplicate views. The code appears well-structured, but there are potential issues with cookie handling and data consistency that need to be addressed.
src/main/java/dev/woori/woorilog/domain/blog/service/BlogService.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/service/BlogService.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/repository/BlogRepository.java
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/repository/BlogRepository.java
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/repository/BlogRepository.java
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/service/BlogService.java
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
블로그 조회수 기능 추가와 중복 증가 방지 로직을 구현하신 것을 확인했습니다. 쿠키를 이용한 중복 조회 방지, @Modifying 애노테이션을 사용한 효율적인 DB 업데이트, 그리고 페이지네이션 성능 개선을 위한 2단계 조회 로직 등 좋은 시도들이 많이 보입니다. 다만, 코드의 유지보수성과 가독성을 높이기 위해 몇 가지 개선할 점을 제안드립니다. 컨트롤러의 역할을 더 가볍게 하고, 서비스 계층에서 비즈니스 로직을 더 많이 책임지도록 구조를 개선하는 것을 고려해보시면 좋겠습니다. 또한, 불필요한 DB 조회나 디버그용 코드가 남아있는 부분을 수정하면 더 완성도 높은 코드가 될 것입니다.
src/main/java/dev/woori/woorilog/domain/blog/controller/BlogController.java
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/service/BlogService.java
Outdated
Show resolved
Hide resolved
src/main/java/dev/woori/woorilog/domain/blog/service/ViewCountService.java
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
블로그 조회수 기능 추가와 중복 증가 방지 로직 구현을 잘 마치셨습니다. 쿠키를 이용한 중복 조회 방지 아이디어가 좋고, 동시성 문제를 완화하기 위해 @Modifying 애노테이션을 사용한 점도 인상 깊습니다.
다만, 몇 가지 개선할 점이 보입니다.
BlogRepository의increaseViewCount메서드 반환 타입이 잘못 지정되어 있어 런타임 오류가 발생할 수 있습니다.- 조회수 증가 로직이
BlogController,BlogService,ViewCountService에 분산되어 있어 구조가 복잡하고 이해하기 어렵습니다. 이를ViewCountService로 통합하여 캡슐화하면 더 좋을 것 같습니다. BlogService에서 불필요한 데이터베이스 조회가 있습니다.
자세한 내용은 각 파일의 코드 리뷰에 남겨두었습니다.
PULL REQUESTS ❤️🔥
이슈 번호 📌
작업 내용 📋
-> @Modifying 애노테이션 사용 (SQL의 원자성을 이용한 동시성 완화)
스크린샷 (선택) 📸
기타 🔥
체크리스트 ✅