mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 17:34:39 -05:00
Move things around and introduce Cursor type
This commit is contained in:
@@ -173,6 +173,7 @@ data class StringFilter(
|
|||||||
val greaterThanOrEqualToInsensitive: String? = null
|
val greaterThanOrEqualToInsensitive: String? = null
|
||||||
) : ComparableScalarFilter<String>
|
) : ComparableScalarFilter<String>
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun <T : String?> andFilterWithCompareString(
|
fun <T : String?> andFilterWithCompareString(
|
||||||
column: Column<T>,
|
column: Column<T>,
|
||||||
filter: StringFilter?
|
filter: StringFilter?
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import suwayomi.tachidesk.graphql.queries.MangaQuery
|
|||||||
import suwayomi.tachidesk.graphql.queries.MetaQuery
|
import suwayomi.tachidesk.graphql.queries.MetaQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.SourceQuery
|
import suwayomi.tachidesk.graphql.queries.SourceQuery
|
||||||
import suwayomi.tachidesk.graphql.queries.UpdatesQuery
|
import suwayomi.tachidesk.graphql.queries.UpdatesQuery
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.GraphQLCursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.GraphQLLongAsString
|
||||||
import suwayomi.tachidesk.graphql.subscriptions.DownloadSubscription
|
import suwayomi.tachidesk.graphql.subscriptions.DownloadSubscription
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KType
|
import kotlin.reflect.KType
|
||||||
@@ -27,6 +30,7 @@ import kotlin.reflect.KType
|
|||||||
class CustomSchemaGeneratorHooks : FlowSubscriptionSchemaGeneratorHooks() {
|
class CustomSchemaGeneratorHooks : FlowSubscriptionSchemaGeneratorHooks() {
|
||||||
override fun willGenerateGraphQLType(type: KType): GraphQLType? = when (type.classifier as? KClass<*>) {
|
override fun willGenerateGraphQLType(type: KType): GraphQLType? = when (type.classifier as? KClass<*>) {
|
||||||
Long::class -> GraphQLLongAsString // encode to string for JS
|
Long::class -> GraphQLLongAsString // encode to string for JS
|
||||||
|
Cursor::class -> GraphQLCursor
|
||||||
else -> super.willGenerateGraphQLType(type)
|
else -> super.willGenerateGraphQLType(type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package suwayomi.tachidesk.graphql.server.primitives
|
||||||
|
|
||||||
|
import graphql.GraphQLContext
|
||||||
|
import graphql.execution.CoercedVariables
|
||||||
|
import graphql.language.StringValue
|
||||||
|
import graphql.language.Value
|
||||||
|
import graphql.scalar.CoercingUtil
|
||||||
|
import graphql.schema.Coercing
|
||||||
|
import graphql.schema.CoercingParseLiteralException
|
||||||
|
import graphql.schema.CoercingParseValueException
|
||||||
|
import graphql.schema.CoercingSerializeException
|
||||||
|
import graphql.schema.GraphQLScalarType
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
data class Cursor(val value: String)
|
||||||
|
|
||||||
|
val GraphQLCursor: GraphQLScalarType = GraphQLScalarType.newScalar()
|
||||||
|
.name("Cursor").description("A location in a connection that can be used for resuming pagination.").coercing(GraphqlCursorCoercing()).build()
|
||||||
|
|
||||||
|
private class GraphqlCursorCoercing : Coercing<Cursor, String> {
|
||||||
|
private fun toStringImpl(input: Any): String? {
|
||||||
|
return (input as? Cursor)?.value
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun parseValueImpl(input: Any, locale: Locale): Cursor {
|
||||||
|
if (input !is String) {
|
||||||
|
throw CoercingParseValueException(
|
||||||
|
CoercingUtil.i18nMsg(
|
||||||
|
locale,
|
||||||
|
"String.unexpectedRawValueType",
|
||||||
|
CoercingUtil.typeName(input)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return Cursor(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun parseLiteralImpl(input: Any, locale: Locale): Cursor {
|
||||||
|
if (input !is StringValue) {
|
||||||
|
throw CoercingParseLiteralException(
|
||||||
|
CoercingUtil.i18nMsg(
|
||||||
|
locale,
|
||||||
|
"Scalar.unexpectedAstType",
|
||||||
|
"StringValue",
|
||||||
|
CoercingUtil.typeName(input)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return Cursor(input.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun valueToLiteralImpl(input: Any): StringValue {
|
||||||
|
return StringValue.newStringValue(input.toString()).build()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("")
|
||||||
|
override fun serialize(dataFetcherResult: Any): String {
|
||||||
|
return toStringImpl(dataFetcherResult) ?: throw CoercingSerializeException(
|
||||||
|
CoercingUtil.i18nMsg(
|
||||||
|
Locale.getDefault(),
|
||||||
|
"String.unexpectedRawValueType",
|
||||||
|
CoercingUtil.typeName(dataFetcherResult)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(CoercingSerializeException::class)
|
||||||
|
override fun serialize(
|
||||||
|
dataFetcherResult: Any,
|
||||||
|
graphQLContext: GraphQLContext,
|
||||||
|
locale: Locale
|
||||||
|
): String {
|
||||||
|
return toStringImpl(dataFetcherResult) ?: throw CoercingSerializeException(
|
||||||
|
CoercingUtil.i18nMsg(
|
||||||
|
locale,
|
||||||
|
"String.unexpectedRawValueType",
|
||||||
|
CoercingUtil.typeName(dataFetcherResult)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("")
|
||||||
|
override fun parseValue(input: Any): Cursor {
|
||||||
|
return parseValueImpl(input, Locale.getDefault())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(CoercingParseValueException::class)
|
||||||
|
override fun parseValue(input: Any, graphQLContext: GraphQLContext, locale: Locale): Cursor {
|
||||||
|
return parseValueImpl(input, locale)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("")
|
||||||
|
override fun parseLiteral(input: Any): Cursor {
|
||||||
|
return parseLiteralImpl(input, Locale.getDefault())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Throws(CoercingParseLiteralException::class)
|
||||||
|
override fun parseLiteral(
|
||||||
|
input: Value<*>,
|
||||||
|
variables: CoercedVariables,
|
||||||
|
graphQLContext: GraphQLContext,
|
||||||
|
locale: Locale
|
||||||
|
): Cursor {
|
||||||
|
return parseLiteralImpl(input, locale)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("")
|
||||||
|
override fun valueToLiteral(input: Any): Value<*> {
|
||||||
|
return valueToLiteralImpl(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun valueToLiteral(
|
||||||
|
input: Any,
|
||||||
|
graphQLContext: GraphQLContext,
|
||||||
|
locale: Locale
|
||||||
|
): Value<*> {
|
||||||
|
return valueToLiteralImpl(input)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package suwayomi.tachidesk.graphql.server
|
package suwayomi.tachidesk.graphql.server.primitives
|
||||||
|
|
||||||
import graphql.GraphQLContext
|
import graphql.GraphQLContext
|
||||||
import graphql.execution.CoercedVariables
|
import graphql.execution.CoercedVariables
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package suwayomi.tachidesk.graphql.types
|
package suwayomi.tachidesk.graphql.server.primitives
|
||||||
|
|
||||||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription
|
import com.expediagroup.graphql.generator.annotations.GraphQLDescription
|
||||||
|
|
||||||
interface Node
|
interface Node
|
||||||
|
|
||||||
typealias Cursor = Int
|
|
||||||
|
|
||||||
abstract class NodeList {
|
abstract class NodeList {
|
||||||
@GraphQLDescription("A list of [T] objects.")
|
@GraphQLDescription("A list of [T] objects.")
|
||||||
abstract val nodes: List<Node>
|
abstract val nodes: List<Node>
|
||||||
@@ -36,5 +34,5 @@ abstract class Edges {
|
|||||||
abstract val cursor: Cursor
|
abstract val cursor: Cursor
|
||||||
|
|
||||||
@GraphQLDescription("The [T] at the end of the edge.")
|
@GraphQLDescription("The [T] at the end of the edge.")
|
||||||
abstract val node: Node?
|
abstract val node: Node
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,11 @@ package suwayomi.tachidesk.graphql.types
|
|||||||
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
||||||
import graphql.schema.DataFetchingEnvironment
|
import graphql.schema.DataFetchingEnvironment
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.model.table.CategoryTable
|
import suwayomi.tachidesk.manga.model.table.CategoryTable
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
@@ -43,7 +48,7 @@ data class CategoryNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class CategoryEdges(
|
data class CategoryEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: CategoryType?
|
override val node: CategoryType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -51,14 +56,14 @@ data class CategoryNodeList(
|
|||||||
return CategoryNodeList(
|
return CategoryNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = CategoryEdges(
|
edges = CategoryEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ package suwayomi.tachidesk.graphql.types
|
|||||||
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
||||||
import graphql.schema.DataFetchingEnvironment
|
import graphql.schema.DataFetchingEnvironment
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
||||||
import suwayomi.tachidesk.manga.model.table.ChapterTable
|
import suwayomi.tachidesk.manga.model.table.ChapterTable
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
@@ -86,7 +91,7 @@ data class ChapterNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class ChapterEdges(
|
data class ChapterEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: ChapterType?
|
override val node: ChapterType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -94,14 +99,14 @@ data class ChapterNodeList(
|
|||||||
return ChapterNodeList(
|
return ChapterNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = ChapterEdges(
|
edges = ChapterEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,6 +8,11 @@
|
|||||||
package suwayomi.tachidesk.graphql.types
|
package suwayomi.tachidesk.graphql.types
|
||||||
|
|
||||||
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter
|
import suwayomi.tachidesk.manga.impl.download.model.DownloadChapter
|
||||||
import suwayomi.tachidesk.manga.impl.download.model.DownloadState
|
import suwayomi.tachidesk.manga.impl.download.model.DownloadState
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.ChapterDataClass
|
||||||
@@ -53,7 +58,7 @@ data class DownloadNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class DownloadEdges(
|
data class DownloadEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: DownloadType?
|
override val node: DownloadType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -61,14 +66,14 @@ data class DownloadNodeList(
|
|||||||
return DownloadNodeList(
|
return DownloadNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = DownloadEdges(
|
edges = DownloadEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ package suwayomi.tachidesk.graphql.types
|
|||||||
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
||||||
import graphql.schema.DataFetchingEnvironment
|
import graphql.schema.DataFetchingEnvironment
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.model.table.ExtensionTable
|
import suwayomi.tachidesk.manga.model.table.ExtensionTable
|
||||||
import java.util.concurrent.CompletableFuture
|
import java.util.concurrent.CompletableFuture
|
||||||
|
|
||||||
@@ -55,7 +60,7 @@ data class ExtensionNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class ExtensionEdges(
|
data class ExtensionEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: ExtensionType?
|
override val node: ExtensionType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -63,14 +68,14 @@ data class ExtensionNodeList(
|
|||||||
return ExtensionNodeList(
|
return ExtensionNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = ExtensionEdges(
|
edges = ExtensionEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ package suwayomi.tachidesk.graphql.types
|
|||||||
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
import com.expediagroup.graphql.server.extensions.getValueFromDataLoader
|
||||||
import graphql.schema.DataFetchingEnvironment
|
import graphql.schema.DataFetchingEnvironment
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.toGenreList
|
import suwayomi.tachidesk.manga.model.dataclass.toGenreList
|
||||||
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
import suwayomi.tachidesk.manga.model.table.MangaStatus
|
||||||
@@ -109,7 +114,7 @@ data class MangaNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class MangaEdges(
|
data class MangaEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: MangaType?
|
override val node: MangaType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -117,14 +122,14 @@ data class MangaNodeList(
|
|||||||
return MangaNodeList(
|
return MangaNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = MangaEdges(
|
edges = MangaEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ package suwayomi.tachidesk.graphql.types
|
|||||||
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
import suwayomi.tachidesk.global.model.table.GlobalMetaTable
|
import suwayomi.tachidesk.global.model.table.GlobalMetaTable
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.model.table.CategoryMetaTable
|
import suwayomi.tachidesk.manga.model.table.CategoryMetaTable
|
||||||
import suwayomi.tachidesk.manga.model.table.ChapterMetaTable
|
import suwayomi.tachidesk.manga.model.table.ChapterMetaTable
|
||||||
import suwayomi.tachidesk.manga.model.table.MangaMetaTable
|
import suwayomi.tachidesk.manga.model.table.MangaMetaTable
|
||||||
@@ -38,7 +43,7 @@ data class MetaNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class MetaEdges(
|
data class MetaEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: MetaItem?
|
override val node: MetaItem
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -46,14 +51,14 @@ data class MetaNodeList(
|
|||||||
return MetaNodeList(
|
return MetaNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = MetaEdges(
|
edges = MetaEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ import eu.kanade.tachiyomi.source.ConfigurableSource
|
|||||||
import graphql.schema.DataFetchingEnvironment
|
import graphql.schema.DataFetchingEnvironment
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.select
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
import suwayomi.tachidesk.manga.impl.extension.Extension
|
import suwayomi.tachidesk.manga.impl.extension.Extension
|
||||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.SourceDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.SourceDataClass
|
||||||
@@ -84,7 +89,7 @@ data class SourceNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class SourceEdges(
|
data class SourceEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: SourceType?
|
override val node: SourceType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -92,14 +97,14 @@ data class SourceNodeList(
|
|||||||
return SourceNodeList(
|
return SourceNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = SourceEdges(
|
edges = SourceEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,6 +8,11 @@
|
|||||||
package suwayomi.tachidesk.graphql.types
|
package suwayomi.tachidesk.graphql.types
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.ResultRow
|
import org.jetbrains.exposed.sql.ResultRow
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edges
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
|
|
||||||
class UpdatesType(
|
class UpdatesType(
|
||||||
val manga: MangaType,
|
val manga: MangaType,
|
||||||
@@ -27,7 +32,7 @@ data class UpdatesNodeList(
|
|||||||
) : NodeList() {
|
) : NodeList() {
|
||||||
data class UpdatesEdges(
|
data class UpdatesEdges(
|
||||||
override val cursor: Cursor,
|
override val cursor: Cursor,
|
||||||
override val node: UpdatesType?
|
override val node: UpdatesType
|
||||||
) : Edges()
|
) : Edges()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -35,14 +40,14 @@ data class UpdatesNodeList(
|
|||||||
return UpdatesNodeList(
|
return UpdatesNodeList(
|
||||||
nodes = this,
|
nodes = this,
|
||||||
edges = UpdatesEdges(
|
edges = UpdatesEdges(
|
||||||
cursor = lastIndex,
|
cursor = Cursor(lastIndex.toString()),
|
||||||
node = lastOrNull()
|
node = last()
|
||||||
),
|
),
|
||||||
pageInfo = PageInfo(
|
pageInfo = PageInfo(
|
||||||
hasNextPage = false,
|
hasNextPage = false,
|
||||||
hasPreviousPage = false,
|
hasPreviousPage = false,
|
||||||
startCursor = 0,
|
startCursor = Cursor(0.toString()),
|
||||||
endCursor = lastIndex
|
endCursor = Cursor(lastIndex.toString())
|
||||||
),
|
),
|
||||||
totalCount = size
|
totalCount = size
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user