Serialize Long as String in graphql

This commit is contained in:
Syer10
2023-03-31 20:30:24 -04:00
parent 37f41ade43
commit 6541c7b5b7
2 changed files with 5 additions and 5 deletions
@@ -11,7 +11,7 @@ import com.expediagroup.graphql.generator.SchemaGeneratorConfig
import com.expediagroup.graphql.generator.TopLevelObject
import com.expediagroup.graphql.generator.hooks.FlowSubscriptionSchemaGeneratorHooks
import com.expediagroup.graphql.generator.toSchema
import graphql.scalars.ExtendedScalars
import graphql.Scalars
import graphql.schema.GraphQLType
import suwayomi.tachidesk.graphql.mutations.ChapterMutation
import suwayomi.tachidesk.graphql.queries.CategoryQuery
@@ -24,7 +24,7 @@ import kotlin.reflect.KType
class CustomSchemaGeneratorHooks : FlowSubscriptionSchemaGeneratorHooks() {
override fun willGenerateGraphQLType(type: KType): GraphQLType? = when (type.classifier as? KClass<*>) {
Long::class -> ExtendedScalars.GraphQLLong
Long::class -> Scalars.GraphQLString // encode to string for JS
else -> super.willGenerateGraphQLType(type)
}
}
@@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture
class MangaType(
val id: Int,
val sourceId: String,
val sourceId: Long,
val url: String,
val title: String,
val thumbnailUrl: String?,
@@ -37,7 +37,7 @@ class MangaType(
) {
constructor(row: ResultRow) : this(
row[MangaTable.id].value,
row[MangaTable.sourceReference].toString(),
row[MangaTable.sourceReference],
row[MangaTable.url],
row[MangaTable.title],
row[MangaTable.thumbnail_url],
@@ -56,7 +56,7 @@ class MangaType(
constructor(dataClass: MangaDataClass) : this(
dataClass.id,
dataClass.sourceId,
dataClass.sourceId.toLong(),
dataClass.url,
dataClass.title,
dataClass.thumbnailUrl,