empty searchTerm support (#259)

* linter run

* convert search params to queryParams
This commit is contained in:
Aria Moradi
2021-11-29 18:42:53 +03:30
committed by GitHub
parent 2478aa77cd
commit 3b73a0fd72
3 changed files with 6 additions and 6 deletions

View File

@@ -47,8 +47,8 @@ object MangaAPI {
get("{sourceId}/filters", SourceController::getFilters) get("{sourceId}/filters", SourceController::getFilters)
post("{sourceId}/filters", SourceController::setFilter) post("{sourceId}/filters", SourceController::setFilter)
get("{sourceId}/search/{searchTerm}/{pageNum}", SourceController::searchSingle) get("{sourceId}/search", SourceController::searchSingle)
// get("search/{searchTerm}/{pageNum}", SourceController::searchGlobal) // get("all/search", SourceController::searchGlobal) // TODO
} }
path("manga") { path("manga") {

View File

@@ -80,8 +80,8 @@ object SourceController {
/** single source search */ /** single source search */
fun searchSingle(ctx: Context) { fun searchSingle(ctx: Context) {
val sourceId = ctx.pathParam("sourceId").toLong() val sourceId = ctx.pathParam("sourceId").toLong()
val searchTerm = ctx.pathParam("searchTerm") val searchTerm = ctx.queryParam("searchTerm") ?: ""
val pageNum = ctx.pathParam("pageNum").toInt() val pageNum = ctx.queryParam("pageNum")?.toInt() ?: 1
ctx.future(future { Search.sourceSearch(sourceId, searchTerm, pageNum) }) ctx.future(future { Search.sourceSearch(sourceId, searchTerm, pageNum) })
} }

View File

@@ -7,6 +7,6 @@ import java.io.File
* *
* This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
fun File.renameTo(newPath: String) = renameTo(File(newPath)) fun File.renameTo(newPath: String) = renameTo(File(newPath))