-
Notifications
You must be signed in to change notification settings - Fork 2
♻️ refactor : 다대다 테이블 변환 #100
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
Conversation
Test Coverage Report
|
Test Results106 tests - 1 106 ✅ - 1 14s ⏱️ +4s Results for commit b3a33e3. ± Comparison against base commit 1a28ff3. This pull request removes 1 test.♻️ This comment has been updated with latest results. |
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.
인기 리뷰 리스트를 제공하기 위한 DTO 구성과 BestReviewSnapshot 또는 Review+해시태그+좋아요 수 기반 생성 로직을 모두 분리해서 제공한 점이 좋은 것 같습니다.
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.
HashTagService는 해시태그를 정렬해서 응답하는 단순하고 명확한 책임을 잘 수행하고 있어요.
특히 Comparator.comparing(HashTag::getType)으로 타입 기준 정렬하고, DTO 변환을 분리한 점은 확장성 측면에서도 좋은 것 같습니다!
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.
리뷰와 해시태그 사이의 연결을 관리하는 서비스로서 create, load, delete, getByReview 등의 기능을 책임별로 잘 나눈 것 같습니다! 또한 해시태그 저장 시 각 파트별 1개 이상 필수 조건을 HashTagType 기준으로 검증한 로직은 비즈니스 로직 표현이 잘 된 것 같습니다!
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.
Auditorium → Seat → ReviewSeat → Review → ReviewHashTag로 전체 경로를 정확히 명시한 점이 아주 좋은 것 같습니다! DTO Projection 방식으로 성능적 이점도 챙겼습니다. 고생하셨습니다!
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.
Review, Seats, Images, HashTags 등의 도메인 데이터를 명확히 분리한 것이 포인트이고, seats.get(0)을 기준으로 상영관 정보를 추출한 판단은 도메인 룰(모든 좌석은 같은 상영관)에 기반해 설계된 것으로 적절한 것 같습니다!
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.
ReviewSeatService는 리뷰와 좌석 간 N:N 관계 매핑 로직을 잘 구현되어 있는 것 같습니다. 다대다 관계에서 흔히 마주치는 여러 시나리오—연결, 조회, 해제, 일괄 조회—에 대한 처리가 명확하게 분리되어 있는 것 같습니다
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.
네가 작성한 ReviewRepositoryImpl#searchReviewsWithFilters 는 검색 조건(키워드, 상영관 ID, 해시태그, 정렬)에 따라 유연하게 동작하도록 잘 설계된 JPA 커스텀 쿼리인 것 같습니다!
soo0711
left a comment
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.
다대다 테이블로 변환하면 고칠게 진짜 많았는데 하나도 빠짐없이 잘 고치신 것 같습니다!! 테스트 부분도 그렇고 ReviewSeat 중간 테이블도 그렇고 정말 꼼꼼하신 것 같습니다 👍 !! hashtag도 도메인으로 따로 빼서 파일 가독성이 더 올라갔네요! 밑에 몇가지 궁금한 점 달아뒀습니다! 수고하셨습니다!
| public interface ReviewLikeCount{ | ||
| Long getReviewCount(); | ||
| Long getLikeCount(); |
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.
ProjectionDTO는 인터페이스와 get을 사용하는건가요?? 진짜 궁금해서 여쭤봅니다!
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.
ProjectionDTO는 인터페이스와 get을 사용하는건가요?? 진짜 궁금해서 여쭤봅니다!
클래스 기반, 또는 인터페이스 기반 Projection 두 가지 방식으로 구분되는걸로 알고있습니다!! 기존에 인터페이스 기반 DTO로 맞춰뒀기에 일관성을 위해 인터페이스로 통일해두었습니다 ㅠㅠ!!
| Review review = reviewService.createReview(request, user.getId()); | ||
|
|
||
| // DTO 변환 | ||
| ReviewSaveResponse response = ReviewSaveResponse.from(review); |
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.
서비스 호출에서 DTO로 변환을 안하고 왜 컨트롤러에서 했는지 궁금합니다!
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.
서비스 호출에서 DTO로 변환을 안하고 왜 컨트롤러에서 했는지 궁금합니다!
헉 맞네요 !! 감사합니다!! 수정하겠습니다👍
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.
서비스 호출에서 DTO로 변환을 안하고 왜 컨트롤러에서 했는지 궁금합니다!
테스트 로직때문에 서비스에서 Review로 끝나야했었네요!! 임시적으로 해두고 추후에 테스트 로직을 수정하는걸로 하겠습니다..!
Test Coverage Report
|
📌 작업한 내용
📁 구조/파일 변경
해시태그, 검색, 컨버터 관련 폴더 기능별로 분리
필요없는 파일 정리
♻️ 리팩토링
Review ↔ Seat 다대다 관계 도입
→ ReviewSeat 중간 테이블 생성 및 적용
기존 리뷰 도메인 및 서비스 코드 전반 수정
Projection DTO 인터페이스화 및 관련 서비스 코드 적용
✨ 기능 추가/수정
리뷰 생성 시, 프론트에 ID 응답값으로 전달되도록 수정
마이페이지 리뷰 개수 및 좋아요 수 조회 로직 수정
검색 로직 정비 및 테스트 구현
마이페이지에서 유저 레벨 계산 로직 정비
✅ 테스트 수정
다대다 관계 적용에 따라 기존 리뷰 테스트 전면 수정
마이페이지 및 검색 관련 테스트 코드 추가
🔍 참고 사항
🖼️ 스크린샷
🔗 관련 이슈
#98 #99
✅ 체크리스트