Library Update Queries and Mutations (#609)

* Add library update GraphQL endpoints

* No need for data classes

* UpdateLibraryManga
This commit is contained in:
Mitchell Syer
2023-08-03 18:08:35 -04:00
committed by GitHub
parent 78a167aacf
commit c3fb08d634
11 changed files with 199 additions and 52 deletions

View File

@@ -80,3 +80,20 @@ class MangaForSourceDataLoader : KotlinDataLoader<Long, MangaNodeList> {
}
}
}
class MangaForIdsDataLoader : KotlinDataLoader<List<Int>, MangaNodeList> {
override val dataLoaderName = "MangaForIdsDataLoader"
override fun getDataLoader(): DataLoader<List<Int>, MangaNodeList> = DataLoaderFactory.newDataLoader { mangaIds ->
future {
transaction {
addLogger(Slf4jSqlDebugLogger)
val ids = mangaIds.flatten().distinct()
val manga = MangaTable.select { MangaTable.id inList ids }
.map { MangaType(it) }
mangaIds.map { mangaIds ->
manga.filter { it.id in mangaIds }.toNodeList()
}
}
}
}
}