fix(filter): add missing filters for: Lubimyczytac, RanobeDB, and Audible ratings, comic specific metadata fields (#647)
This commit is contained in:
@@ -27,6 +27,9 @@ public record AppFilterOptions(
|
||||
List<CountedOption> amazonRatings,
|
||||
List<CountedOption> goodreadsRatings,
|
||||
List<CountedOption> hardcoverRatings,
|
||||
List<CountedOption> lubimyczytacRatings,
|
||||
List<CountedOption> ranobedbRatings,
|
||||
List<CountedOption> audibleRatings,
|
||||
List<CountedOption> pageCounts,
|
||||
List<CountedOption> shelfStatuses,
|
||||
List<CountedOption> comicCharacters,
|
||||
|
||||
@@ -33,6 +33,9 @@ public record BookListRequest(
|
||||
@Size(max = 20) List<String> amazonRating,
|
||||
@Size(max = 20) List<String> goodreadsRating,
|
||||
@Size(max = 20) List<String> hardcoverRating,
|
||||
@Size(max = 20) List<String> lubimyczytacRating,
|
||||
@Size(max = 20) List<String> ranobedbRating,
|
||||
@Size(max = 20) List<String> audibleRating,
|
||||
@Size(max = 20) List<String> pageCount,
|
||||
@Size(max = 20) List<String> shelfStatus,
|
||||
@Size(max = 20) List<String> comicCharacter,
|
||||
|
||||
@@ -585,6 +585,9 @@ public class AppBookService {
|
||||
List<AppFilterOptions.CountedOption> amazonRatings = queryRatingBuckets("m.amazonRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> goodreadsRatings = queryRatingBuckets("m.goodreadsRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> hardcoverRatings = queryRatingBuckets("m.hardcoverRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> lubimyczytacRatings = queryRatingBuckets("m.lubimyczytacRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> ranobedbRatings = queryRatingBuckets("m.ranobedbRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> audibleRatings = queryRatingBuckets("m.audibleRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
|
||||
List<AppFilterOptions.CountedOption> pageCounts = queryGroupedCount(
|
||||
"CASE " +
|
||||
@@ -663,6 +666,9 @@ public class AppBookService {
|
||||
.amazonRatings(amazonRatings)
|
||||
.goodreadsRatings(goodreadsRatings)
|
||||
.hardcoverRatings(hardcoverRatings)
|
||||
.lubimyczytacRatings(lubimyczytacRatings)
|
||||
.ranobedbRatings(ranobedbRatings)
|
||||
.audibleRatings(audibleRatings)
|
||||
.pageCounts(pageCounts)
|
||||
.shelfStatuses(shelfStatuses)
|
||||
.comicCharacters(comicCharacters)
|
||||
@@ -697,6 +703,9 @@ public class AppBookService {
|
||||
.amazonRatings(Collections.emptyList())
|
||||
.goodreadsRatings(Collections.emptyList())
|
||||
.hardcoverRatings(Collections.emptyList())
|
||||
.lubimyczytacRatings(Collections.emptyList())
|
||||
.ranobedbRatings(Collections.emptyList())
|
||||
.audibleRatings(Collections.emptyList())
|
||||
.pageCounts(Collections.emptyList())
|
||||
.shelfStatuses(Collections.emptyList())
|
||||
.comicCharacters(Collections.emptyList())
|
||||
@@ -958,6 +967,27 @@ public class AppBookService {
|
||||
}
|
||||
}
|
||||
|
||||
if (req.lubimyczytacRating() != null && !req.lubimyczytacRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.lubimyczytacRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withLubimyczytacRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.ranobedbRating() != null && !req.ranobedbRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.ranobedbRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withRanobedbRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.audibleRating() != null && !req.audibleRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.audibleRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withAudibleRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.pageCount() != null && !req.pageCount().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.pageCount());
|
||||
if (!cleaned.isEmpty()) {
|
||||
|
||||
@@ -675,6 +675,18 @@ public class AppBookSpecification {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "hardcoverRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withLubimyczytacRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "lubimyczytacRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withRanobedbRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "ranobedbRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withAudibleRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "audibleRating");
|
||||
}
|
||||
|
||||
private static Specification<BookEntity> buildRatingRangeSpec(
|
||||
List<String> rangeIds, String mode, String fieldName) {
|
||||
return (root, query, cb) -> {
|
||||
|
||||
Reference in New Issue
Block a user