mirror of
https://github.com/gotson/komga.git
synced 2025-12-22 00:13:30 +01:00
feat(api): search series by tag
This commit is contained in:
parent
f46f1a0e96
commit
7bd1de6f78
3 changed files with 10 additions and 3 deletions
|
|
@ -6,7 +6,8 @@ open class SeriesSearch(
|
|||
val searchTerm: String? = null,
|
||||
val metadataStatus: Collection<SeriesMetadata.Status>? = null,
|
||||
val publishers: Collection<String>? = null,
|
||||
val languages: Collection<String>? = null
|
||||
val languages: Collection<String>? = null,
|
||||
val tags: Collection<String>? = null
|
||||
)
|
||||
|
||||
class SeriesSearchWithReadProgress(
|
||||
|
|
@ -16,5 +17,6 @@ class SeriesSearchWithReadProgress(
|
|||
metadataStatus: Collection<SeriesMetadata.Status>? = null,
|
||||
publishers: Collection<String>? = null,
|
||||
languages: Collection<String>? = null,
|
||||
tags: Collection<String>? = null,
|
||||
val readStatus: Collection<ReadStatus>? = null
|
||||
) : SeriesSearch(libraryIds, collectionIds, searchTerm, metadataStatus, publishers, languages)
|
||||
) : SeriesSearch(libraryIds, collectionIds, searchTerm, metadataStatus, publishers, languages, tags)
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ class SeriesDtoDao(
|
|||
.leftJoin(b).on(s.ID.eq(b.SERIES_ID))
|
||||
.leftJoin(d).on(s.ID.eq(d.SERIES_ID))
|
||||
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
|
||||
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
|
||||
.and(readProgressCondition(userId))
|
||||
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))
|
||||
|
||||
|
|
@ -114,6 +115,7 @@ class SeriesDtoDao(
|
|||
.leftJoin(b).on(s.ID.eq(b.SERIES_ID))
|
||||
.leftJoin(d).on(s.ID.eq(d.SERIES_ID))
|
||||
.leftJoin(r).on(b.ID.eq(r.BOOK_ID))
|
||||
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
|
||||
.and(readProgressCondition(userId))
|
||||
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))
|
||||
.where(conditions)
|
||||
|
|
@ -187,6 +189,7 @@ class SeriesDtoDao(
|
|||
metadataStatus?.let { c = c.and(d.STATUS.`in`(it)) }
|
||||
publishers?.let { publishers -> c = c.and(lower(d.PUBLISHER).`in`(publishers.map { it.toLowerCase() })) }
|
||||
languages?.let { languages -> c = c.and(lower(d.LANGUAGE).`in`(languages.map { it.toLowerCase() })) }
|
||||
tags?.let { tags -> c = c.and(lower(st.TAG).`in`(tags.map { it.toLowerCase() })) }
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class SeriesController(
|
|||
@RequestParam(name = "read_status", required = false) readStatus: List<ReadStatus>?,
|
||||
@RequestParam(name = "publisher", required = false) publishers: List<String>?,
|
||||
@RequestParam(name = "language", required = false) languages: List<String>?,
|
||||
@RequestParam(name = "tag", required = false) tags: List<String>?,
|
||||
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
|
||||
@Parameter(hidden = true) page: Pageable
|
||||
): Page<SeriesDto> {
|
||||
|
|
@ -101,7 +102,8 @@ class SeriesController(
|
|||
metadataStatus = metadataStatus,
|
||||
readStatus = readStatus,
|
||||
publishers = publishers,
|
||||
languages = languages
|
||||
languages = languages,
|
||||
tags = tags
|
||||
)
|
||||
|
||||
return seriesDtoRepository.findAll(seriesSearch, principal.user.id, pageRequest)
|
||||
|
|
|
|||
Loading…
Reference in a new issue