mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 06:42:07 +01:00
queries
This commit is contained in:
@@ -34,8 +34,7 @@ abstract class TrackService(val id: Long) {
|
|||||||
get() = networkService.client
|
get() = networkService.client
|
||||||
|
|
||||||
// Name of the manga sync service to display
|
// Name of the manga sync service to display
|
||||||
// @StringRes
|
abstract val name: String
|
||||||
// abstract fun nameRes(): String
|
|
||||||
|
|
||||||
// Application and remote support for reading dates
|
// Application and remote support for reading dates
|
||||||
open val supportsReadingDates: Boolean = false
|
open val supportsReadingDates: Boolean = false
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ class MangaUpdates(id: Long) : TrackService(id) {
|
|||||||
|
|
||||||
private val api by lazy { MangaUpdatesApi(interceptor, client) }
|
private val api by lazy { MangaUpdatesApi(interceptor, client) }
|
||||||
|
|
||||||
// @StringRes
|
override val name: String = "MangaUpdates"
|
||||||
// override fun nameRes(): String = R.string.tracker_manga_updates
|
|
||||||
|
|
||||||
// override fun getLogo(): Int = R.drawable.ic_manga_updates
|
// override fun getLogo(): Int = R.drawable.ic_manga_updates
|
||||||
|
|
||||||
@@ -36,11 +35,11 @@ class MangaUpdates(id: Long) : TrackService(id) {
|
|||||||
|
|
||||||
// @StringRes
|
// @StringRes
|
||||||
override fun getStatus(status: Int): String? = when (status) {
|
override fun getStatus(status: Int): String? = when (status) {
|
||||||
READING_LIST -> "R.string.reading_list"
|
READING_LIST -> "Reading List"
|
||||||
WISH_LIST -> "R.string.wish_list"
|
WISH_LIST -> "Wish List"
|
||||||
COMPLETE_LIST -> "R.string.complete_list"
|
COMPLETE_LIST -> "Complete List"
|
||||||
ON_HOLD_LIST -> "R.string.on_hold_list"
|
ON_HOLD_LIST -> ">On Hold List"
|
||||||
UNFINISHED_LIST -> "R.string.unfinished_list"
|
UNFINISHED_LIST -> "Unfinished List"
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package suwayomi.tachidesk.graphql.queries
|
||||||
|
|
||||||
|
import suwayomi.tachidesk.graphql.types.TrackServiceType
|
||||||
|
import suwayomi.tachidesk.server.trackManager
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
class TrackQuery {
|
||||||
|
fun trackService(id: Long): TrackServiceType? =
|
||||||
|
trackManager.services.find { it.id == id }?.let {
|
||||||
|
TrackServiceType(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun trackServices(): List<TrackServiceType> = trackManager.services.map {
|
||||||
|
TrackServiceType(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ import suwayomi.tachidesk.graphql.queries.ExtensionQuery
|
|||||||
import suwayomi.tachidesk.graphql.queries.MangaQuery
|
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.TrackQuery
|
||||||
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
import suwayomi.tachidesk.graphql.server.primitives.GraphQLCursor
|
import suwayomi.tachidesk.graphql.server.primitives.GraphQLCursor
|
||||||
import suwayomi.tachidesk.graphql.server.primitives.GraphQLLongAsString
|
import suwayomi.tachidesk.graphql.server.primitives.GraphQLLongAsString
|
||||||
@@ -53,7 +54,8 @@ val schema = toSchema(
|
|||||||
TopLevelObject(ExtensionQuery()),
|
TopLevelObject(ExtensionQuery()),
|
||||||
TopLevelObject(MangaQuery()),
|
TopLevelObject(MangaQuery()),
|
||||||
TopLevelObject(MetaQuery()),
|
TopLevelObject(MetaQuery()),
|
||||||
TopLevelObject(SourceQuery())
|
TopLevelObject(SourceQuery()),
|
||||||
|
TopLevelObject(TrackQuery())
|
||||||
),
|
),
|
||||||
mutations = listOf(
|
mutations = listOf(
|
||||||
TopLevelObject(CategoryMutation()),
|
TopLevelObject(CategoryMutation()),
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package suwayomi.tachidesk.graphql.types
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Cursor
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Edge
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.Node
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.NodeList
|
||||||
|
import suwayomi.tachidesk.graphql.server.primitives.PageInfo
|
||||||
|
|
||||||
|
data class TrackServiceType(
|
||||||
|
val id: Long,
|
||||||
|
val name: String
|
||||||
|
) : Node {
|
||||||
|
constructor(trackService: TrackService) : this(
|
||||||
|
trackService.id,
|
||||||
|
trackService.name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class TrackServiceNodeList(
|
||||||
|
override val nodes: List<TrackServiceType>,
|
||||||
|
override val edges: List<TrackServiceEdge>,
|
||||||
|
override val pageInfo: PageInfo,
|
||||||
|
override val totalCount: Int
|
||||||
|
) : NodeList() {
|
||||||
|
data class TrackServiceEdge(
|
||||||
|
override val cursor: Cursor,
|
||||||
|
override val node: TrackServiceType
|
||||||
|
) : Edge()
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ package suwayomi.tachidesk.server
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.App
|
import eu.kanade.tachiyomi.App
|
||||||
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.source.local.LocalSource
|
import eu.kanade.tachiyomi.source.local.LocalSource
|
||||||
import io.javalin.plugin.json.JavalinJackson
|
import io.javalin.plugin.json.JavalinJackson
|
||||||
import io.javalin.plugin.json.JsonMapper
|
import io.javalin.plugin.json.JsonMapper
|
||||||
@@ -55,6 +56,8 @@ val systemTrayInstance by lazy { systemTray() }
|
|||||||
|
|
||||||
val androidCompat by lazy { AndroidCompat() }
|
val androidCompat by lazy { AndroidCompat() }
|
||||||
|
|
||||||
|
val trackManager by lazy { TrackManager() }
|
||||||
|
|
||||||
fun applicationSetup() {
|
fun applicationSetup() {
|
||||||
logger.info("Running Tachidesk ${BuildConfig.VERSION} revision ${BuildConfig.REVISION}")
|
logger.info("Running Tachidesk ${BuildConfig.VERSION} revision ${BuildConfig.REVISION}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user