mirror of
https://github.com/gotson/komga.git
synced 2025-12-22 08:23:04 +01:00
feat(api): search series by publisher
This commit is contained in:
parent
fb8a8c4228
commit
e4b0b2d1f7
3 changed files with 9 additions and 4 deletions
|
|
@ -4,7 +4,8 @@ open class SeriesSearch(
|
|||
val libraryIds: Collection<String>? = null,
|
||||
val collectionIds: Collection<Long>? = null,
|
||||
val searchTerm: String? = null,
|
||||
val metadataStatus: Collection<SeriesMetadata.Status>? = null
|
||||
val metadataStatus: Collection<SeriesMetadata.Status>? = null,
|
||||
val publishers: Collection<String>? = null
|
||||
)
|
||||
|
||||
class SeriesSearchWithReadProgress(
|
||||
|
|
@ -12,5 +13,6 @@ class SeriesSearchWithReadProgress(
|
|||
collectionIds: Collection<Long>? = null,
|
||||
searchTerm: String? = null,
|
||||
metadataStatus: Collection<SeriesMetadata.Status>? = null,
|
||||
publishers: Collection<String>? = null,
|
||||
val readStatus: Collection<ReadStatus>? = null
|
||||
) : SeriesSearch(libraryIds, collectionIds, searchTerm, metadataStatus)
|
||||
) : SeriesSearch(libraryIds, collectionIds, searchTerm, metadataStatus, publishers)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.jooq.ResultQuery
|
|||
import org.jooq.SelectOnConditionStep
|
||||
import org.jooq.impl.DSL
|
||||
import org.jooq.impl.DSL.inline
|
||||
import org.jooq.impl.DSL.lower
|
||||
import org.springframework.data.domain.Page
|
||||
import org.springframework.data.domain.PageImpl
|
||||
import org.springframework.data.domain.PageRequest
|
||||
|
|
@ -184,6 +185,7 @@ class SeriesDtoDao(
|
|||
collectionIds?.let { c = c.and(cs.COLLECTION_ID.`in`(it)) }
|
||||
searchTerm?.let { c = c.and(d.TITLE.containsIgnoreCase(it)) }
|
||||
metadataStatus?.let { c = c.and(d.STATUS.`in`(it)) }
|
||||
publishers?.let { publishers -> c = c.and(lower(d.PUBLISHER).`in`(publishers.map { it.toLowerCase() })) }
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import io.swagger.v3.oas.annotations.media.Schema
|
|||
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
||||
import mu.KotlinLogging
|
||||
import org.gotson.komga.application.tasks.TaskReceiver
|
||||
import org.gotson.komga.domain.model.Author
|
||||
import org.gotson.komga.domain.model.BookSearchWithReadProgress
|
||||
import org.gotson.komga.domain.model.Media
|
||||
import org.gotson.komga.domain.model.ROLE_ADMIN
|
||||
|
|
@ -78,6 +77,7 @@ class SeriesController(
|
|||
@RequestParam(name = "collection_id", required = false) collectionIds: List<Long>?,
|
||||
@RequestParam(name = "status", required = false) metadataStatus: List<SeriesMetadata.Status>?,
|
||||
@RequestParam(name = "read_status", required = false) readStatus: List<ReadStatus>?,
|
||||
@RequestParam(name = "publisher", required = false) publishers: List<String>?,
|
||||
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
|
||||
@Parameter(hidden = true) page: Pageable
|
||||
): Page<SeriesDto> {
|
||||
|
|
@ -98,7 +98,8 @@ class SeriesController(
|
|||
collectionIds = collectionIds,
|
||||
searchTerm = searchTerm,
|
||||
metadataStatus = metadataStatus,
|
||||
readStatus = readStatus
|
||||
readStatus = readStatus,
|
||||
publishers = publishers
|
||||
)
|
||||
|
||||
return seriesDtoRepository.findAll(seriesSearch, principal.user.id, pageRequest)
|
||||
|
|
|
|||
Loading…
Reference in a new issue