mirror of
https://github.com/gotson/komga.git
synced 2026-04-17 04:22:19 +02:00
parent
f5221420fd
commit
c96bf19048
1 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import org.gotson.komga.application.service.AsyncOrchestrator
|
||||||
import org.gotson.komga.domain.model.Library
|
import org.gotson.komga.domain.model.Library
|
||||||
import org.gotson.komga.domain.model.Media
|
import org.gotson.komga.domain.model.Media
|
||||||
import org.gotson.komga.domain.model.Series
|
import org.gotson.komga.domain.model.Series
|
||||||
|
import org.gotson.komga.domain.model.SeriesMetadata
|
||||||
import org.gotson.komga.domain.persistence.BookRepository
|
import org.gotson.komga.domain.persistence.BookRepository
|
||||||
import org.gotson.komga.domain.persistence.SeriesRepository
|
import org.gotson.komga.domain.persistence.SeriesRepository
|
||||||
import org.gotson.komga.infrastructure.security.KomgaPrincipal
|
import org.gotson.komga.infrastructure.security.KomgaPrincipal
|
||||||
|
|
@ -55,6 +56,7 @@ class SeriesController(
|
||||||
@AuthenticationPrincipal principal: KomgaPrincipal,
|
@AuthenticationPrincipal principal: KomgaPrincipal,
|
||||||
@RequestParam(name = "search", required = false) searchTerm: String?,
|
@RequestParam(name = "search", required = false) searchTerm: String?,
|
||||||
@RequestParam(name = "library_id", required = false) libraryIds: List<Long>?,
|
@RequestParam(name = "library_id", required = false) libraryIds: List<Long>?,
|
||||||
|
@RequestParam(name = "status", required = false) metadataStatus: List<SeriesMetadata.Status>?,
|
||||||
page: Pageable
|
page: Pageable
|
||||||
): Page<SeriesDto> {
|
): Page<SeriesDto> {
|
||||||
val pageRequest = PageRequest.of(
|
val pageRequest = PageRequest.of(
|
||||||
|
|
@ -86,6 +88,10 @@ class SeriesController(
|
||||||
specs.add(Series::name.likeLower("%$searchTerm%"))
|
specs.add(Series::name.likeLower("%$searchTerm%"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!metadataStatus.isNullOrEmpty()) {
|
||||||
|
specs.add(Series::metadata.toJoin().where(SeriesMetadata::status).`in`(metadataStatus))
|
||||||
|
}
|
||||||
|
|
||||||
if (specs.isNotEmpty()) {
|
if (specs.isNotEmpty()) {
|
||||||
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec)!! }, pageRequest)
|
seriesRepository.findAll(specs.reduce { acc, spec -> acc.and(spec)!! }, pageRequest)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue