mirror of
https://github.com/adityachandelgit/BookLore.git
synced 2026-01-13 20:19:03 +00:00
opds sort by addedon Desc by default (#1691)
Co-authored-by: WorldTeacher <admin@theprivateserver.de>
This commit is contained in:
@ -20,7 +20,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
// ALL BOOKS - Two Query Pattern
|
||||
// ============================================
|
||||
|
||||
@Query("SELECT b.id FROM BookEntity b WHERE (b.deleted IS NULL OR b.deleted = false)")
|
||||
@Query("SELECT b.id FROM BookEntity b WHERE (b.deleted IS NULL OR b.deleted = false) ORDER BY b.addedOn DESC")
|
||||
Page<Long> findBookIds(Pageable pageable);
|
||||
|
||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
||||
@ -40,7 +40,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
// BOOKS BY LIBRARY IDs - Two Query Pattern
|
||||
// ============================================
|
||||
|
||||
@Query("SELECT b.id FROM BookEntity b WHERE b.library.id IN :libraryIds AND (b.deleted IS NULL OR b.deleted = false)")
|
||||
@Query("SELECT b.id FROM BookEntity b WHERE b.library.id IN :libraryIds AND (b.deleted IS NULL OR b.deleted = false) ORDER BY b.addedOn DESC")
|
||||
Page<Long> findBookIdsByLibraryIds(@Param("libraryIds") Collection<Long> libraryIds, Pageable pageable);
|
||||
|
||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
||||
@ -60,7 +60,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
// BOOKS BY SHELF ID - Two Query Pattern
|
||||
// ============================================
|
||||
|
||||
@Query("SELECT DISTINCT b.id FROM BookEntity b JOIN b.shelves s WHERE s.id = :shelfId AND (b.deleted IS NULL OR b.deleted = false)")
|
||||
@Query("SELECT DISTINCT b.id FROM BookEntity b JOIN b.shelves s WHERE s.id = :shelfId AND (b.deleted IS NULL OR b.deleted = false) ORDER BY b.addedOn DESC")
|
||||
Page<Long> findBookIdsByShelfId(@Param("shelfId") Long shelfId, Pageable pageable);
|
||||
|
||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
||||
@ -81,6 +81,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
OR LOWER(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||
OR LOWER(a.name) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||
)
|
||||
ORDER BY b.addedOn DESC
|
||||
""")
|
||||
Page<Long> findBookIdsByMetadataSearch(@Param("text") String text, Pageable pageable);
|
||||
|
||||
@ -104,6 +105,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
OR LOWER(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||
OR LOWER(a.name) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||
)
|
||||
ORDER BY b.addedOn DESC
|
||||
""")
|
||||
Page<Long> findBookIdsByMetadataSearchAndLibraryIds(@Param("text") String text, @Param("libraryIds") Collection<Long> libraryIds, Pageable pageable);
|
||||
|
||||
@ -120,4 +122,4 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
||||
|
||||
@Query(value = "SELECT b.id FROM BookEntity b WHERE b.library.id IN :libraryIds AND (b.deleted IS NULL OR b.deleted = false) ORDER BY function('RAND')", nativeQuery = false)
|
||||
List<Long> findRandomBookIdsByLibraryIds(@Param("libraryIds") Collection<Long> libraryIds);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user