diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookSearch.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookSearch.kt index b8bd41db1..1cea23370 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookSearch.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookSearch.kt @@ -1,11 +1,14 @@ package org.gotson.komga.domain.model +import java.time.LocalDate + open class BookSearch( val libraryIds: Collection? = null, val seriesIds: Collection? = null, val searchTerm: String? = null, val mediaStatus: Collection? = null, val deleted: Boolean? = null, + val releasedAfter: LocalDate? = null, ) class BookSearchWithReadProgress( @@ -14,6 +17,7 @@ class BookSearchWithReadProgress( searchTerm: String? = null, mediaStatus: Collection? = null, deleted: Boolean? = null, + releasedAfter: LocalDate? = null, val tags: Collection? = null, val readStatus: Collection? = null, val authors: Collection? = null, @@ -22,5 +26,6 @@ class BookSearchWithReadProgress( seriesIds = seriesIds, searchTerm = searchTerm, mediaStatus = mediaStatus, - deleted = deleted + deleted = deleted, + releasedAfter = releasedAfter, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt index 389c3a516..53eb91ce7 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt @@ -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 } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDao.kt index 73d4ff082..da53fc4d8 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDao.kt @@ -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) { 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 dd94deda2..2c12a2b60 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 @@ -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?, @RequestParam(name = "media_status", required = false) mediaStatus: List?, @RequestParam(name = "read_status", required = false) readStatus: List?, + @RequestParam(name = "released_after", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) releasedAfter: LocalDate?, @RequestParam(name = "tag", required = false) tags: List?, @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 )