diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesSearch.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesSearch.kt index ccd8c7db2..d2a8dd1fa 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesSearch.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesSearch.kt @@ -18,6 +18,7 @@ class SeriesSearchWithReadProgress( val genres: Collection? = null, val tags: Collection? = null, val ageRatings: Collection? = null, + val releaseYears: Collection? = null, val readStatus: Collection? = null ) : SeriesSearch( libraryIds = libraryIds, diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDao.kt index 853923376..3c2765ad7 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDao.kt @@ -218,6 +218,8 @@ class SeriesDtoDao( val c2 = if (ageRatings.filterNotNull().isNotEmpty()) d.AGE_RATING.`in`(ageRatings.filterNotNull()) else DSL.falseCondition() c = c.and(c1.or(c2)) } + // cast to String is necessary for SQLite, else the years in the IN block are coerced to Int, even though YEAR for SQLite uses strftime (string) + if(!releaseYears.isNullOrEmpty()) c = c.and(DSL.year(bma.RELEASE_DATE).cast(String::class.java).`in`(releaseYears)) return c } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesCollectionController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesCollectionController.kt index 76ce41902..fa824e433 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesCollectionController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesCollectionController.kt @@ -166,6 +166,7 @@ class SeriesCollectionController( @RequestParam(name = "genre", required = false) genres: List?, @RequestParam(name = "tag", required = false) tags: List?, @RequestParam(name = "age_rating", required = false) ageRatings: List?, + @RequestParam(name = "release_year", required = false) release_years: List?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) page: Pageable ): Page = @@ -190,7 +191,8 @@ class SeriesCollectionController( languages = languages, genres = genres, tags = tags, - ageRatings = ageRatings?.map { it.toIntOrNull() } + ageRatings = ageRatings?.map { it.toIntOrNull() }, + releaseYears = release_years, ) seriesDtoRepository.findByCollectionId(collection.id, seriesSearch, principal.user.id, pageRequest) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesController.kt index 23142cb83..26f8ca962 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/rest/SeriesController.kt @@ -82,6 +82,7 @@ class SeriesController( @RequestParam(name = "genre", required = false) genres: List?, @RequestParam(name = "tag", required = false) tags: List?, @RequestParam(name = "age_rating", required = false) ageRatings: List?, + @RequestParam(name = "release_year", required = false) release_years: List?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) page: Pageable ): Page { @@ -107,7 +108,8 @@ class SeriesController( languages = languages, genres = genres, tags = tags, - ageRatings = ageRatings?.map { it.toIntOrNull() } + ageRatings = ageRatings?.map { it.toIntOrNull() }, + releaseYears = release_years, ) return seriesDtoRepository.findAll(seriesSearch, principal.user.id, pageRequest)