Skip to content

Commit

Permalink
feat: 사용자 한줄평 조회 시 저자와 출판사도 반환하도록 수정 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdohyung committed May 31, 2024
1 parent 5afa03b commit bd6909c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ public class ReviewContentResponse {

private String bookImage;

private String authors;

private String publisher;

@Builder
@QueryProjection
public ReviewContentResponse(
Long reviewId, String userImage, String userName, Double rating, String content,
String isbn, String title, String bookImage) {
public ReviewContentResponse(Long reviewId, String userImage, String userName, Double rating, String content,
String isbn, String title, String bookImage, String authors, String publisher) {
this.reviewId = reviewId;
this.userImage = userImage;
this.userName = userName;
Expand All @@ -38,6 +41,7 @@ public ReviewContentResponse(
this.isbn = isbn;
this.title = title;
this.bookImage = bookImage;
this.authors = authors;
this.publisher = publisher;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ private List<ReviewContentResponse> getReviewContents(
return queryFactory
.select(new QReviewContentResponse(
review.id, review.user.profileImage, review.user.name, rating1.rating, review.content,
review.book.isbn, review.book.title, review.book.imageUrl
review.book.isbn, review.book.title, review.book.imageUrl, review.book.authors,
review.book.publisher
))
.from(review)
.leftJoin(rating1).on(review.user.eq(rating1.user), review.book.eq(rating1.book))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,12 @@ void getUserReviews() throws Exception {
.description("책 ISBN"),
fieldWithPath("data.reviewContents.queryResponse[].title").type(JsonFieldType.STRING)
.description("책 제목"),
fieldWithPath("data.reviewContents.queryResponse[].bookImage").type(
JsonFieldType.STRING)
fieldWithPath("data.reviewContents.queryResponse[].bookImage").type(JsonFieldType.STRING)
.description("책 표지"),
fieldWithPath("data.reviewContents.queryResponse[].authors").type(JsonFieldType.STRING)
.description("책 저자"),
fieldWithPath("data.reviewContents.queryResponse[].publisher").type(JsonFieldType.STRING)
.description("책 출판사"),
fieldWithPath("data.reviewContents.totalCount").type(JsonFieldType.NUMBER)
.description("총 리뷰 개수"),
fieldWithPath("data.reviewContents.size").type(JsonFieldType.NUMBER)
Expand Down Expand Up @@ -323,6 +326,8 @@ private List<ReviewContentResponse> createReviewFindAllResponse() {
.isbn(String.valueOf(i))
.title("title" + i)
.bookImage("bookImage" + i)
.authors("저자" + i)
.publisher("출판사" + i)
.build())
.toList();
}
Expand Down

0 comments on commit bd6909c

Please sign in to comment.