diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/GraphQL.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/GraphQL.kt index 82093452..46600e72 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/GraphQL.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/GraphQL.kt @@ -12,7 +12,7 @@ import suwayomi.tachidesk.graphql.controller.GraphQLController object GraphQL { fun defineEndpoints() { - post("graphql", GraphQLController.execute) + post("graphql", GraphQLController::execute) // graphql playground get("graphql", GraphQLController::playground) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt index 615db95c..5dd3812a 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt @@ -9,36 +9,21 @@ package suwayomi.tachidesk.graphql.controller import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import io.javalin.http.Context -import io.javalin.http.HttpCode import suwayomi.tachidesk.graphql.impl.getGraphQLServer import suwayomi.tachidesk.server.JavalinSetup.future -import suwayomi.tachidesk.server.util.handler -import suwayomi.tachidesk.server.util.withOperation object GraphQLController { private val mapper = jacksonObjectMapper() private val tachideskGraphQLServer = getGraphQLServer(mapper) /** execute graphql query */ - val execute = handler( - documentWith = { - withOperation { - summary("GraphQL endpoint") - description("Endpoint for GraphQL endpoints") + fun execute(ctx: Context) { + ctx.future( + future { + tachideskGraphQLServer.execute(ctx) } - }, - - behaviorOf = { ctx -> - ctx.future( - future { - tachideskGraphQLServer.execute(ctx) - } - ) - }, - withResults = { - json(HttpCode.OK) - } - ) + ) + } fun playground(ctx: Context) { val playgroundHtml = javaClass.getResource("/graphql-playground.html")