Skip to content

Commit

Permalink
feat(api): search series by genre
Browse files Browse the repository at this point in the history
  • Loading branch information
gotson committed Aug 24, 2020
1 parent 7bd1de6 commit da4a0aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ open class SeriesSearch(
val metadataStatus: Collection<SeriesMetadata.Status>? = null,
val publishers: Collection<String>? = null,
val languages: Collection<String>? = null,
val genres: Collection<String>? = null,
val tags: Collection<String>? = null
)

Expand All @@ -17,6 +18,16 @@ class SeriesSearchWithReadProgress(
metadataStatus: Collection<SeriesMetadata.Status>? = null,
publishers: Collection<String>? = null,
languages: Collection<String>? = null,
genres: Collection<String>? = null,
tags: Collection<String>? = null,
val readStatus: Collection<ReadStatus>? = null
) : SeriesSearch(libraryIds, collectionIds, searchTerm, metadataStatus, publishers, languages, tags)
) : SeriesSearch(
libraryIds = libraryIds,
collectionIds = collectionIds,
searchTerm = searchTerm,
metadataStatus = metadataStatus,
publishers = publishers,
languages = languages,
genres = genres,
tags = tags
)
Original file line number Diff line number Diff line change
Expand Up @@ -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(g).on(s.ID.eq(g.SERIES_ID))
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
.and(readProgressCondition(userId))
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))
Expand All @@ -115,6 +116,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(g).on(s.ID.eq(g.SERIES_ID))
.leftJoin(st).on(s.ID.eq(st.SERIES_ID))
.and(readProgressCondition(userId))
.leftJoin(cs).on(s.ID.eq(cs.SERIES_ID))
Expand Down Expand Up @@ -189,6 +191,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() })) }
genres?.let { genres -> c = c.and(lower(g.GENRE).`in`(genres.map { it.toLowerCase() })) }
tags?.let { tags -> c = c.and(lower(st.TAG).`in`(tags.map { it.toLowerCase() })) }

return c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "genre", required = false) genres: List<String>?,
@RequestParam(name = "tag", required = false) tags: List<String>?,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable
Expand All @@ -103,6 +104,7 @@ class SeriesController(
readStatus = readStatus,
publishers = publishers,
languages = languages,
genres = genres,
tags = tags
)

Expand Down

0 comments on commit da4a0aa

Please sign in to comment.