Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #154 from Project-Books/null-covers-153
Browse files Browse the repository at this point in the history
fix: covers always null
  • Loading branch information
knjk04 authored Mar 20, 2022
2 parents 19e63ee + e1be0e8 commit 2b1c75a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +28,7 @@ public interface BookRepository extends CrudRepository<Book, Long> {
@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"
)
Expand All @@ -39,9 +39,8 @@ public interface BookRepository extends CrudRepository<Book, Long> {

Book findBookByIsbn13(String isbn13);

@Query(value = "SELECT b FROM Book b WHERE lower(b.title) = lower(:title)")
List<Book> findByTitleIgnoreCase(String title);

@Query(value =
"SELECT b.* FROM book b " +
"LEFT JOIN publisher_book pb ON pb.book_id = b.id " +
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/schema/book.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Book {
publishers: [Publisher!]!
lang: Lang!
publishingFormat: PublishingFormat
covers: [Cover]
cover: Cover
awards: [Award!]!
}

0 comments on commit 2b1c75a

Please sign in to comment.