fix: handle multiple book files with the same checksum (#1724)
This commit is contained in:
@@ -55,10 +55,10 @@ public interface BookRepository extends JpaRepository<BookEntity, Long>, JpaSpec
|
||||
List<BookEntity> findAllForSummaryByIds(@Param("bookIds") Collection<Long> bookIds);
|
||||
|
||||
@EntityGraph(attributePaths = {"bookFiles", "metadata", "library", "libraryPath"})
|
||||
@Query("SELECT b FROM BookEntity b JOIN b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false)")
|
||||
@Query("SELECT b FROM BookEntity b JOIN b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false) ORDER BY b.id DESC LIMIT 1")
|
||||
Optional<BookEntity> findByCurrentHash(@Param("currentHash") String currentHash);
|
||||
|
||||
@Query("SELECT b FROM BookEntity b JOIN FETCH b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false OR b.deletedAt > :cutoff)")
|
||||
@Query("SELECT b FROM BookEntity b JOIN FETCH b.bookFiles bf WHERE bf.currentHash = :currentHash AND bf.isBookFormat = true AND (b.deleted IS NULL OR b.deleted = false OR b.deletedAt > :cutoff) ORDER BY b.id DESC LIMIT 1")
|
||||
Optional<BookEntity> findByCurrentHashIncludingRecentlyDeleted(@Param("currentHash") String currentHash, @Param("cutoff") Instant cutoff);
|
||||
|
||||
Optional<BookEntity> findByBookCoverHash(String bookCoverHash);
|
||||
|
||||
Reference in New Issue
Block a user