-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #53 - feat: isbn13 을 활용하여 해당 책의 한줄요약 리스트 조회 구현. 또한 한줄요약 리스트 조회 구현 * #53 - feat: 책과 관련된 한줄요약 수 가져오는 기능 구현 * #53 - feat: 전체 한줄요약, 해당 책의 한줄요약, 책의 한줄요약 개수 조회하는 테스트 코드 구현
- Loading branch information
Showing
7 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/cotato/bookitlist/review/dto/response/ReviewCountResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cotato.bookitlist.review.dto.response; | ||
|
||
public record ReviewCountResponse( | ||
int count | ||
) { | ||
public static ReviewCountResponse of(int count) { | ||
return new ReviewCountResponse(count); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/cotato/bookitlist/review/dto/response/ReviewListResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cotato.bookitlist.review.dto.response; | ||
|
||
import cotato.bookitlist.review.domain.Review; | ||
import cotato.bookitlist.review.dto.ReviewDto; | ||
import org.springframework.data.domain.Page; | ||
|
||
import java.util.List; | ||
|
||
public record ReviewListResponse( | ||
int totalResults, | ||
int totalPages, | ||
int startIndex, | ||
int itemsPerPage, | ||
List<ReviewDto> reviewDtoList | ||
) { | ||
public static ReviewListResponse from(Page<Review> page) { | ||
return new ReviewListResponse( | ||
(int) page.getTotalElements(), | ||
page.getTotalPages(), | ||
page.getNumber(), | ||
page.getSize(), | ||
page.stream().map(ReviewDto::from).toList() | ||
); | ||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/main/java/cotato/bookitlist/review/repository/ReviewRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
package cotato.bookitlist.review.repository; | ||
|
||
import cotato.bookitlist.book.domain.entity.Book; | ||
import cotato.bookitlist.review.domain.Review; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ReviewRepository extends JpaRepository<Review, Long> { | ||
|
||
List<Review> findAllByBook(Book book); | ||
Page<Review> findByBook_Isbn13(String isbn13, Pageable pageable); | ||
int countByBook_Isbn13(String isbn13); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters