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

[Feature] 도서와 관련된 리뷰 조회 API 구현 #108

Merged
merged 5 commits into from
May 25, 2024

Conversation

jwooo
Copy link
Collaborator

@jwooo jwooo commented May 24, 2024

💡 연관된 이슈

close #90

📝 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요.

  • 도서와 관련된 리뷰 조회 API 구현
  • 도서와 관련된 리뷰 조회 API 테스트 작성
  • 도서와 관련된 리뷰 조회 API Docs 작성

💬 리뷰 요구 사항

@jwooo jwooo added the ✨ Feature 기능 개발 label May 24, 2024
@jwooo jwooo requested review from pdohyung and AHNYUNKI May 24, 2024 12:23
@jwooo jwooo self-assigned this May 24, 2024
@jwooo jwooo linked an issue May 24, 2024 that may be closed by this pull request
2 tasks
Copy link
Member

@pdohyung pdohyung left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 ~ 👍
답변 남겨주시고 머지하시면 됩니다 !

Comment on lines +31 to +55
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)));
}
Copy link
Member

@pdohyung pdohyung May 25, 2024

Choose a reason for hiding this comment

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

쿼리의 조인 전략을 enum 클래스에 분리하신 이유가 궁금합니다 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

해당 쿼리는 orderType에 의해 조인 전략이 변경됩니다. 그렇기 때문에 조인을 추가하는 것은 orderType에 책임이 있다고 생각하여 해당 ENUM에서 추가하는 것으로 분리하였습니다!

Copy link
Member

@AHNYUNKI AHNYUNKI left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

@jwooo jwooo merged commit 9339927 into develop May 25, 2024
1 check passed
@jwooo jwooo deleted the feature/90-get-reviews-related-book branch May 25, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 도서와 관련된 리뷰 조회 API 구현
3 participants