diff --git a/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java b/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java index 41cef9a44..99a980922 100644 --- a/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java +++ b/backend/src/main/java/org/booklore/app/specification/AppBookSpecification.java @@ -164,38 +164,6 @@ public class AppBookSpecification { }; } - public static Specification withReadStatus(ReadStatus status, Long userId) { - return (root, query, cb) -> { - if (status == null || userId == null) { - return cb.conjunction(); - } - Subquery subquery = query.subquery(Long.class); - Root progressRoot = subquery.from(UserBookProgressEntity.class); - subquery.select(progressRoot.get("book").get("id")) - .where( - cb.equal(progressRoot.get("user").get("id"), userId), - cb.equal(progressRoot.get("readStatus"), status) - ); - return root.get("id").in(subquery); - }; - } - - public static Specification inProgress(Long userId) { - return (root, query, cb) -> { - if (userId == null) { - return cb.conjunction(); - } - Subquery subquery = query.subquery(Long.class); - Root progressRoot = subquery.from(UserBookProgressEntity.class); - subquery.select(progressRoot.get("book").get("id")) - .where( - cb.equal(progressRoot.get("user").get("id"), userId), - progressRoot.get("readStatus").in(ReadStatus.READING, ReadStatus.RE_READING) - ); - return root.get("id").in(subquery); - }; - } - /** * Filter books that have any progress for a specific user. * If `optional` is true, allow books without user progress to be included @@ -263,10 +231,6 @@ public class AppBookSpecification { return (root, query, cb) -> cb.isNotNull(root.get("scannedOn")); } - public static Specification hasDigitalFile() { - return (root, query, cb) -> cb.isNotEmpty(root.get("bookFiles")); - } - public static Specification hasDigitalFileOrIsPhysical() { return (root, query, cb) -> cb.or( cb.isNotEmpty(root.get("bookFiles")), @@ -274,42 +238,6 @@ public class AppBookSpecification { ); } - public static Specification hasAudiobookFile() { - return (root, query, cb) -> { - Subquery subquery = query.subquery(Long.class); - Root bookFileRoot = subquery.from(BookFileEntity.class); - subquery.select(bookFileRoot.get("book").get("id")) - .where(cb.equal(bookFileRoot.get("bookType"), BookFileType.AUDIOBOOK)); - return root.get("id").in(subquery); - }; - } - - public static Specification hasNonAudiobookFile() { - return (root, query, cb) -> { - Subquery subquery = query.subquery(Long.class); - Root bookFileRoot = subquery.from(BookFileEntity.class); - subquery.select(bookFileRoot.get("book").get("id")) - .where(cb.notEqual(bookFileRoot.get("bookType"), BookFileType.AUDIOBOOK)); - return root.get("id").in(subquery); - }; - } - - /** - * Filter books that have at least one file of the given type. - */ - public static Specification withFileType(BookFileType fileType) { - return (root, query, cb) -> { - if (fileType == null) { - return cb.conjunction(); - } - Subquery subquery = query.subquery(Long.class); - Root bookFileRoot = subquery.from(BookFileEntity.class); - subquery.select(bookFileRoot.get("book").get("id")) - .where(cb.equal(bookFileRoot.get("bookType"), fileType)); - return root.get("id").in(subquery); - }; - } - /** * Filter books by multiple file types with mode support. * OR = books with at least one file of ANY listed type @@ -480,13 +408,6 @@ public class AppBookSpecification { }; } - /** - * Filter books by author name (case-insensitive exact match). - */ - public static Specification withAuthor(String authorName) { - return withAuthors(authorName == null ? List.of() : List.of(authorName), "or"); - } - /** * Filter books by multiple author names with mode support. * OR = books with ANY of the authors @@ -503,13 +424,6 @@ public class AppBookSpecification { }; } - /** - * Filter books by language code (case-insensitive). - */ - public static Specification withLanguage(String language) { - return withLanguages(language == null ? List.of() : List.of(language), "or"); - } - /** * Filter books by multiple language codes with mode support. */ @@ -538,10 +452,6 @@ public class AppBookSpecification { }; } - public static Specification withCategory(String categoryName) { - return withCategories(categoryName == null ? List.of() : List.of(categoryName), "or"); - } - /** * Filter books by multiple categories with mode support. */ @@ -555,10 +465,6 @@ public class AppBookSpecification { }; } - public static Specification withPublisher(String publisher) { - return withPublishers(publisher == null ? List.of() : List.of(publisher), "or"); - } - /** * Filter books by multiple publishers with mode support. */ @@ -571,10 +477,6 @@ public class AppBookSpecification { }; } - public static Specification withTag(String tagName) { - return withTags(tagName == null ? List.of() : List.of(tagName), "or"); - } - /** * Filter books by multiple tags with mode support. */ @@ -588,10 +490,6 @@ public class AppBookSpecification { }; } - public static Specification withMood(String moodName) { - return withMoods(moodName == null ? List.of() : List.of(moodName), "or"); - } - /** * Filter books by multiple moods with mode support. */ @@ -605,10 +503,6 @@ public class AppBookSpecification { }; } - public static Specification withNarrator(String narrator) { - return withNarrators(narrator == null ? List.of() : List.of(narrator), "or"); - } - /** * Filter books by multiple narrators with mode support. */