More signals

This commit is contained in:
aditya.chandel
2024-12-18 16:08:22 -07:00
parent 71f5927364
commit ce515649f6
14 changed files with 160 additions and 129 deletions
@@ -43,16 +43,12 @@ public class LibraryController {
return libraryService.parseLibraryBooks(libraryId, force);
}
@DeleteMapping("/{libraryId}")
public ResponseEntity<?> deleteLibrary(@PathVariable long libraryId) {
libraryService.deleteLibrary(libraryId);
return ResponseEntity.noContent().build();
}
@GetMapping("/{libraryId}/book/{bookId}/withNeighbors")
public ResponseEntity<BookWithNeighborsDTO> getBookWithNeighbours(@PathVariable long libraryId, @PathVariable long bookId) {
return ResponseEntity.ok(booksService.getBookWithNeighbours(libraryId, bookId));
@@ -21,6 +21,8 @@ public interface BookRepository extends JpaRepository<Book, Long>, JpaSpecificat
Optional<Book> findBookByIdAndLibraryId(long id, long libraryId);
Optional<Book> findBookByFileNameAndLibraryId(String fileName, long libraryId);
@Query("SELECT b FROM Book b JOIN b.metadata bm WHERE LOWER(bm.title) LIKE LOWER(CONCAT('%', :title, '%'))")
List<Book> findByTitleContainingIgnoreCase(@Param("title") String title);
@@ -40,7 +40,7 @@ public class PdfFileProcessor implements FileProcessor {
File bookFile = new File(libraryFile.getFilePath());
String fileName = bookFile.getName();
if (!forceProcess) {
Optional<Book> bookOptional = bookRepository.findByFileName(fileName);
Optional<Book> bookOptional = bookRepository.findBookByFileNameAndLibraryId(fileName, libraryFile.getLibrary().getId());
if (bookOptional.isPresent()) {
return FileProcessResult.builder()
.libraryFile(libraryFile)