Skip to content

Commit

Permalink
feat(api): filter /series endpoint by library_id
Browse files Browse the repository at this point in the history
closes gotson#360
  • Loading branch information
gotson committed Jan 5, 2021
1 parent 2c08741 commit 1603a96
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class SeriesController(
@GetMapping("/latest")
fun getLatestSeries(
@AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable
): Page<SeriesDto> {
Expand All @@ -133,7 +134,7 @@ class SeriesController(
)

return seriesDtoRepository.findAll(
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(null)),
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(libraryIds)),
principal.user.id,
pageRequest
).map { it.restrictUrl(!principal.user.roleAdmin) }
Expand All @@ -144,6 +145,7 @@ class SeriesController(
@GetMapping("/new")
fun getNewSeries(
@AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable
): Page<SeriesDto> {
Expand All @@ -158,7 +160,7 @@ class SeriesController(
)

return seriesDtoRepository.findAll(
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(null)),
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(libraryIds)),
principal.user.id,
pageRequest
).map { it.restrictUrl(!principal.user.roleAdmin) }
Expand All @@ -169,6 +171,7 @@ class SeriesController(
@GetMapping("/updated")
fun getUpdatedSeries(
@AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable
): Page<SeriesDto> {
Expand All @@ -183,7 +186,7 @@ class SeriesController(
)

return seriesDtoRepository.findRecentlyUpdated(
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(null)),
SeriesSearchWithReadProgress(principal.user.getAuthorizedLibraryIds(libraryIds)),
principal.user.id,
pageRequest
).map { it.restrictUrl(!principal.user.roleAdmin) }
Expand Down

0 comments on commit 1603a96

Please sign in to comment.