mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 15:34:17 +01:00
feat(api): add released_after query parameter for /books endpoint
This commit is contained in:
parent
0f4b22615d
commit
f6dc546fd9
4 changed files with 12 additions and 1 deletions
|
|
@ -1,11 +1,14 @@
|
|||
package org.gotson.komga.domain.model
|
||||
|
||||
import java.time.LocalDate
|
||||
|
||||
open class BookSearch(
|
||||
val libraryIds: Collection<String>? = null,
|
||||
val seriesIds: Collection<String>? = null,
|
||||
val searchTerm: String? = null,
|
||||
val mediaStatus: Collection<Media.Status>? = null,
|
||||
val deleted: Boolean? = null,
|
||||
val releasedAfter: LocalDate? = null,
|
||||
)
|
||||
|
||||
class BookSearchWithReadProgress(
|
||||
|
|
@ -14,6 +17,7 @@ class BookSearchWithReadProgress(
|
|||
searchTerm: String? = null,
|
||||
mediaStatus: Collection<Media.Status>? = null,
|
||||
deleted: Boolean? = null,
|
||||
releasedAfter: LocalDate? = null,
|
||||
val tags: Collection<String>? = null,
|
||||
val readStatus: Collection<ReadStatus>? = null,
|
||||
val authors: Collection<Author>? = null,
|
||||
|
|
@ -22,5 +26,6 @@ class BookSearchWithReadProgress(
|
|||
seriesIds = seriesIds,
|
||||
searchTerm = searchTerm,
|
||||
mediaStatus = mediaStatus,
|
||||
deleted = deleted
|
||||
deleted = deleted,
|
||||
releasedAfter = releasedAfter,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -285,6 +285,7 @@ class BookDao(
|
|||
if (!mediaStatus.isNullOrEmpty()) c = c.and(m.STATUS.`in`(mediaStatus))
|
||||
if (deleted == true) c = c.and(b.DELETED_DATE.isNotNull)
|
||||
if (deleted == false) c = c.and(b.DELETED_DATE.isNull)
|
||||
if (releasedAfter != null) c = c.and(d.RELEASE_DATE.gt(releasedAfter))
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ class BookDtoDao(
|
|||
if (!mediaStatus.isNullOrEmpty()) c = c.and(m.STATUS.`in`(mediaStatus))
|
||||
if (deleted == true) c = c.and(b.DELETED_DATE.isNotNull)
|
||||
if (deleted == false) c = c.and(b.DELETED_DATE.isNull)
|
||||
if (releasedAfter != null) c = c.and(d.RELEASE_DATE.gt(releasedAfter))
|
||||
if (!tags.isNullOrEmpty()) c = c.and(lower(bt.TAG).`in`(tags.map { it.lowercase() }))
|
||||
|
||||
if (readStatus != null) {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import org.springframework.data.domain.Page
|
|||
import org.springframework.data.domain.PageRequest
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.data.domain.Sort
|
||||
import org.springframework.format.annotation.DateTimeFormat
|
||||
import org.springframework.http.ContentDisposition
|
||||
import org.springframework.http.HttpHeaders
|
||||
import org.springframework.http.HttpStatus
|
||||
|
|
@ -71,6 +72,7 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
|
|||
import java.io.FileNotFoundException
|
||||
import java.io.OutputStream
|
||||
import java.nio.file.NoSuchFileException
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneOffset
|
||||
import javax.validation.Valid
|
||||
import kotlin.io.path.name
|
||||
|
|
@ -99,6 +101,7 @@ class BookController(
|
|||
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
|
||||
@RequestParam(name = "media_status", required = false) mediaStatus: List<Media.Status>?,
|
||||
@RequestParam(name = "read_status", required = false) readStatus: List<ReadStatus>?,
|
||||
@RequestParam(name = "released_after", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) releasedAfter: LocalDate?,
|
||||
@RequestParam(name = "tag", required = false) tags: List<String>?,
|
||||
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
|
||||
@Parameter(hidden = true) page: Pageable
|
||||
|
|
@ -120,6 +123,7 @@ class BookController(
|
|||
searchTerm = searchTerm,
|
||||
mediaStatus = mediaStatus,
|
||||
readStatus = readStatus,
|
||||
releasedAfter = releasedAfter,
|
||||
tags = tags
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue