opds sort by addedon Desc by default (#1691)
Co-authored-by: WorldTeacher <admin@theprivateserver.de>
This commit is contained in:
co-authored by
WorldTeacher
parent
ff2654db1b
commit
8e8d57af73
+6
-4
@@ -20,7 +20,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
|||||||
// ALL BOOKS - Two Query Pattern
|
// 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);
|
Page<Long> findBookIds(Pageable pageable);
|
||||||
|
|
||||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
||||||
@@ -40,7 +40,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
|||||||
// BOOKS BY LIBRARY IDs - Two Query Pattern
|
// 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);
|
Page<Long> findBookIdsByLibraryIds(@Param("libraryIds") Collection<Long> libraryIds, Pageable pageable);
|
||||||
|
|
||||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
||||||
@@ -60,7 +60,7 @@ public interface BookOpdsRepository extends JpaRepository<BookEntity, Long>, Jpa
|
|||||||
// BOOKS BY SHELF ID - Two Query Pattern
|
// 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);
|
Page<Long> findBookIdsByShelfId(@Param("shelfId") Long shelfId, Pageable pageable);
|
||||||
|
|
||||||
@EntityGraph(attributePaths = {"metadata", "additionalFiles", "shelves"})
|
@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(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR LOWER(a.name) 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);
|
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(m.seriesName) LIKE LOWER(CONCAT('%', :text, '%'))
|
||||||
OR LOWER(a.name) 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);
|
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)
|
@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);
|
List<Long> findRandomBookIdsByLibraryIds(@Param("libraryIds") Collection<Long> libraryIds);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user