-
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
[Feature] 도서와 관련된 리뷰 조회 API 구현 #108
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.
수고하셨습니다 ~ 👍
답변 남겨주시고 머지하시면 됩니다 !
public void applyJoinStrategy(JPAQuery<?> query) { | ||
joinRatingStrategy.accept(query); | ||
applyCommonJoinConditions(query); | ||
} | ||
|
||
public static ReviewOrderType fromString(String name) { | ||
try { | ||
return ReviewOrderType.valueOf(name.toUpperCase()); | ||
} catch (IllegalArgumentException | NullPointerException e) { | ||
return ReviewOrderType.LIKE; | ||
} | ||
} | ||
|
||
private static void joinRating(JPAQuery<?> query) { | ||
query.join(rating1); | ||
} | ||
|
||
private static void leftJoinRating(JPAQuery<?> query) { | ||
query.leftJoin(rating1); | ||
} | ||
|
||
private static void applyCommonJoinConditions(JPAQuery<?> query) { | ||
query.on(review.user.eq(rating1.user) | ||
.and(review.book.eq(rating1.book))); | ||
} |
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.
쿼리의 조인 전략을 enum 클래스에 분리하신 이유가 궁금합니다 !
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.
해당 쿼리는 orderType
에 의해 조인 전략이 변경됩니다. 그렇기 때문에 조인을 추가하는 것은 orderType
에 책임이 있다고 생각하여 해당 ENUM
에서 추가하는 것으로 분리하였습니다!
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 #90
📝 작업 내용
이번 PR에서 작업한 내용을 간략히 설명해주세요.
💬 리뷰 요구 사항