diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt index 0a91ba5fc..a0e19d63a 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/BookController.kt @@ -2,6 +2,7 @@ package org.gotson.komga.interfaces.rest import com.github.klinq.jpaspec.`in` import com.github.klinq.jpaspec.likeLower +import com.github.klinq.jpaspec.toJoin import mu.KotlinLogging import org.gotson.komga.application.service.AsyncOrchestrator import org.gotson.komga.application.service.BookLifecycle @@ -62,6 +63,7 @@ class BookController( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "library_id", required = false) libraryIds: List?, + @RequestParam(name = "media_status", required = false) mediaStatus: List?, page: Pageable ): Page { val pageRequest = PageRequest.of( @@ -90,6 +92,10 @@ class BookController( specs.add(Book::name.likeLower("%$searchTerm%")) } + if (!mediaStatus.isNullOrEmpty()) { + specs.add(Book::media.toJoin().where(Media::status).`in`(mediaStatus)) + } + if (specs.isNotEmpty()) { bookRepository.findAll(specs.reduce { acc, spec -> acc.and(spec)!! }, pageRequest) } else {