diff --git a/src/main/java/com/karankumar/booksapi/repository/BookRepository.java b/src/main/java/com/karankumar/booksapi/repository/BookRepository.java index 1076ac84..3aeee4b5 100644 --- a/src/main/java/com/karankumar/booksapi/repository/BookRepository.java +++ b/src/main/java/com/karankumar/booksapi/repository/BookRepository.java @@ -17,7 +17,6 @@ import com.karankumar.booksapi.model.Book; import com.karankumar.booksapi.model.award.AwardName; -import com.karankumar.booksapi.model.genre.GenreName; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; @@ -29,6 +28,7 @@ public interface BookRepository extends CrudRepository { @Query(value = "SELECT b FROM Book b " + "LEFT JOIN FETCH b.authors " + + "LEFT JOIN FETCH b.cover " + "LEFT JOIN FETCH b.publishers " + "LEFT JOIN FETCH b.awards" ) @@ -39,9 +39,8 @@ public interface BookRepository extends CrudRepository { Book findBookByIsbn13(String isbn13); - @Query(value = "SELECT b FROM Book b WHERE lower(b.title) = lower(:title)") List findByTitleIgnoreCase(String title); - + @Query(value = "SELECT b.* FROM book b " + "LEFT JOIN publisher_book pb ON pb.book_id = b.id " + diff --git a/src/main/resources/schema/book.graphqls b/src/main/resources/schema/book.graphqls index 6b1f38dc..2a066ed0 100644 --- a/src/main/resources/schema/book.graphqls +++ b/src/main/resources/schema/book.graphqls @@ -10,7 +10,7 @@ type Book { publishers: [Publisher!]! lang: Lang! publishingFormat: PublishingFormat - covers: [Cover] + cover: Cover awards: [Award!]! }