Delete updates query since the chapters query can now mimic it

This commit is contained in:
Syer10
2023-04-08 22:55:56 -04:00
parent 313da99536
commit b617250eff
3 changed files with 1 additions and 119 deletions

View File

@@ -1,49 +0,0 @@
/*
* 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/. */
package suwayomi.tachidesk.graphql.queries
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
import suwayomi.tachidesk.graphql.types.UpdatesNodeList
import suwayomi.tachidesk.graphql.types.UpdatesNodeList.Companion.toNodeList
import suwayomi.tachidesk.graphql.types.UpdatesType
import suwayomi.tachidesk.manga.model.dataclass.PaginationFactor
import suwayomi.tachidesk.manga.model.table.ChapterTable
import suwayomi.tachidesk.manga.model.table.MangaTable
/**
* TODO Queries
* - Maybe replace with a chapter query with a sort
*
* TODO Mutations
* - Update the library
* - Update a category
* - Reset updater
*
*/
class UpdatesQuery {
data class UpdatesQueryInput(
val page: Int
)
fun updates(input: UpdatesQueryInput): UpdatesNodeList {
val results = transaction {
ChapterTable.innerJoin(MangaTable)
.select { (MangaTable.inLibrary eq true) and (ChapterTable.fetchedAt greater MangaTable.inLibraryAt) }
.orderBy(ChapterTable.fetchedAt to SortOrder.DESC)
.limit(PaginationFactor, (input.page - 1L) * PaginationFactor)
.map {
UpdatesType(it)
}
}
return results.toNodeList() // todo paged
}
}