mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 11:24:35 -05:00
Downloader Queries and Mutations (#610)
* Add downloader GraphQL endpoints * Fix names * DeleteDownloadedChapter(s) * DequeueChapterDownload(s)
This commit is contained in:
@@ -393,21 +393,7 @@ object Chapter {
|
||||
|
||||
private fun deleteChapters(input: MangaChapterBatchEditInput, mangaId: Int? = null) {
|
||||
if (input.chapterIds != null) {
|
||||
val chapterIds = input.chapterIds
|
||||
|
||||
transaction {
|
||||
ChapterTable.slice(ChapterTable.manga, ChapterTable.id)
|
||||
.select { ChapterTable.id inList chapterIds }
|
||||
.forEach { row ->
|
||||
val chapterMangaId = row[ChapterTable.manga].value
|
||||
val chapterId = row[ChapterTable.id].value
|
||||
ChapterDownloadHelper.delete(chapterMangaId, chapterId)
|
||||
}
|
||||
|
||||
ChapterTable.update({ ChapterTable.id inList chapterIds }) {
|
||||
it[isDownloaded] = false
|
||||
}
|
||||
}
|
||||
deleteChapters(input.chapterIds)
|
||||
} else if (input.chapterIndexes != null && mangaId != null) {
|
||||
transaction {
|
||||
val chapterIds = ChapterTable.slice(ChapterTable.manga, ChapterTable.id)
|
||||
@@ -426,6 +412,22 @@ object Chapter {
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteChapters(chapterIds: List<Int>) {
|
||||
transaction {
|
||||
ChapterTable.slice(ChapterTable.manga, ChapterTable.id)
|
||||
.select { ChapterTable.id inList chapterIds }
|
||||
.forEach { row ->
|
||||
val chapterMangaId = row[ChapterTable.manga].value
|
||||
val chapterId = row[ChapterTable.id].value
|
||||
ChapterDownloadHelper.delete(chapterMangaId, chapterId)
|
||||
}
|
||||
|
||||
ChapterTable.update({ ChapterTable.id inList chapterIds }) {
|
||||
it[isDownloaded] = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getRecentChapters(pageNum: Int): PaginatedList<MangaChapterDataClass> {
|
||||
return paginatedFrom(pageNum) {
|
||||
transaction {
|
||||
|
||||
Reference in New Issue
Block a user