mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-08 05:14:37 -05:00
Switch to a new Ktlint Formatter (#705)
* Switch to new Ktlint plugin * Add ktlintCheck to PR builds * Run formatter * Put ktlint version in libs toml * Fix lint * Use Zip4Java from libs.toml
This commit is contained in:
@@ -16,14 +16,14 @@ import java.util.concurrent.CompletableFuture
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class DownloadMutation {
|
||||
|
||||
data class DeleteDownloadedChaptersInput(
|
||||
val clientMutationId: String? = null,
|
||||
val ids: List<Int>
|
||||
val ids: List<Int>,
|
||||
)
|
||||
|
||||
data class DeleteDownloadedChaptersPayload(
|
||||
val clientMutationId: String?,
|
||||
val chapters: List<ChapterType>
|
||||
val chapters: List<ChapterType>,
|
||||
)
|
||||
|
||||
fun deleteDownloadedChapters(input: DeleteDownloadedChaptersInput): DeleteDownloadedChaptersPayload {
|
||||
@@ -33,20 +33,22 @@ class DownloadMutation {
|
||||
|
||||
return DeleteDownloadedChaptersPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
chapters = transaction {
|
||||
ChapterTable.select { ChapterTable.id inList chapters }
|
||||
.map { ChapterType(it) }
|
||||
}
|
||||
chapters =
|
||||
transaction {
|
||||
ChapterTable.select { ChapterTable.id inList chapters }
|
||||
.map { ChapterType(it) }
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
data class DeleteDownloadedChapterInput(
|
||||
val clientMutationId: String? = null,
|
||||
val id: Int
|
||||
val id: Int,
|
||||
)
|
||||
|
||||
data class DeleteDownloadedChapterPayload(
|
||||
val clientMutationId: String?,
|
||||
val chapters: ChapterType
|
||||
val chapters: ChapterType,
|
||||
)
|
||||
|
||||
fun deleteDownloadedChapter(input: DeleteDownloadedChapterInput): DeleteDownloadedChapterPayload {
|
||||
@@ -56,24 +58,24 @@ class DownloadMutation {
|
||||
|
||||
return DeleteDownloadedChapterPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
chapters = transaction {
|
||||
ChapterType(ChapterTable.select { ChapterTable.id eq chapter }.first())
|
||||
}
|
||||
chapters =
|
||||
transaction {
|
||||
ChapterType(ChapterTable.select { ChapterTable.id eq chapter }.first())
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
data class EnqueueChapterDownloadsInput(
|
||||
val clientMutationId: String? = null,
|
||||
val ids: List<Int>
|
||||
)
|
||||
data class EnqueueChapterDownloadsPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val ids: List<Int>,
|
||||
)
|
||||
|
||||
fun enqueueChapterDownloads(
|
||||
input: EnqueueChapterDownloadsInput
|
||||
): CompletableFuture<EnqueueChapterDownloadsPayload> {
|
||||
data class EnqueueChapterDownloadsPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun enqueueChapterDownloads(input: EnqueueChapterDownloadsInput): CompletableFuture<EnqueueChapterDownloadsPayload> {
|
||||
val (clientMutationId, chapters) = input
|
||||
|
||||
DownloadManager.enqueue(DownloadManager.EnqueueInput(chapters))
|
||||
@@ -81,25 +83,25 @@ class DownloadMutation {
|
||||
return future {
|
||||
EnqueueChapterDownloadsPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.any { it.chapter.id in chapters } })
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.any { it.chapter.id in chapters } })
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class EnqueueChapterDownloadInput(
|
||||
val clientMutationId: String? = null,
|
||||
val id: Int
|
||||
)
|
||||
data class EnqueueChapterDownloadPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val id: Int,
|
||||
)
|
||||
|
||||
fun enqueueChapterDownload(
|
||||
input: EnqueueChapterDownloadInput
|
||||
): CompletableFuture<EnqueueChapterDownloadPayload> {
|
||||
data class EnqueueChapterDownloadPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun enqueueChapterDownload(input: EnqueueChapterDownloadInput): CompletableFuture<EnqueueChapterDownloadPayload> {
|
||||
val (clientMutationId, chapter) = input
|
||||
|
||||
DownloadManager.enqueue(DownloadManager.EnqueueInput(listOf(chapter)))
|
||||
@@ -107,25 +109,25 @@ class DownloadMutation {
|
||||
return future {
|
||||
EnqueueChapterDownloadPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.any { it.chapter.id == chapter } })
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.any { it.chapter.id == chapter } })
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class DequeueChapterDownloadsInput(
|
||||
val clientMutationId: String? = null,
|
||||
val ids: List<Int>
|
||||
)
|
||||
data class DequeueChapterDownloadsPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val ids: List<Int>,
|
||||
)
|
||||
|
||||
fun dequeueChapterDownloads(
|
||||
input: DequeueChapterDownloadsInput
|
||||
): CompletableFuture<DequeueChapterDownloadsPayload> {
|
||||
data class DequeueChapterDownloadsPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun dequeueChapterDownloads(input: DequeueChapterDownloadsInput): CompletableFuture<DequeueChapterDownloadsPayload> {
|
||||
val (clientMutationId, chapters) = input
|
||||
|
||||
DownloadManager.dequeue(DownloadManager.EnqueueInput(chapters))
|
||||
@@ -133,25 +135,25 @@ class DownloadMutation {
|
||||
return future {
|
||||
DequeueChapterDownloadsPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.none { it.chapter.id in chapters } })
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.none { it.chapter.id in chapters } })
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class DequeueChapterDownloadInput(
|
||||
val clientMutationId: String? = null,
|
||||
val id: Int
|
||||
)
|
||||
data class DequeueChapterDownloadPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val id: Int,
|
||||
)
|
||||
|
||||
fun dequeueChapterDownload(
|
||||
input: DequeueChapterDownloadInput
|
||||
): CompletableFuture<DequeueChapterDownloadPayload> {
|
||||
data class DequeueChapterDownloadPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun dequeueChapterDownload(input: DequeueChapterDownloadInput): CompletableFuture<DequeueChapterDownloadPayload> {
|
||||
val (clientMutationId, chapter) = input
|
||||
|
||||
DownloadManager.dequeue(DownloadManager.EnqueueInput(listOf(chapter)))
|
||||
@@ -159,19 +161,21 @@ class DownloadMutation {
|
||||
return future {
|
||||
DequeueChapterDownloadPayload(
|
||||
clientMutationId = clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.none { it.chapter.id == chapter } })
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(DownloadManager.status.first { it.queue.none { it.chapter.id == chapter } })
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class StartDownloaderInput(
|
||||
val clientMutationId: String? = null
|
||||
val clientMutationId: String? = null,
|
||||
)
|
||||
|
||||
data class StartDownloaderPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun startDownloader(input: StartDownloaderInput): CompletableFuture<StartDownloaderPayload> {
|
||||
@@ -180,21 +184,23 @@ class DownloadMutation {
|
||||
return future {
|
||||
StartDownloaderPayload(
|
||||
input.clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Started }
|
||||
)
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Started },
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class StopDownloaderInput(
|
||||
val clientMutationId: String? = null
|
||||
val clientMutationId: String? = null,
|
||||
)
|
||||
|
||||
data class StopDownloaderPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun stopDownloader(input: StopDownloaderInput): CompletableFuture<StopDownloaderPayload> {
|
||||
@@ -202,21 +208,23 @@ class DownloadMutation {
|
||||
DownloadManager.stop()
|
||||
StopDownloaderPayload(
|
||||
input.clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Stopped }
|
||||
)
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Stopped },
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class ClearDownloaderInput(
|
||||
val clientMutationId: String? = null
|
||||
val clientMutationId: String? = null,
|
||||
)
|
||||
|
||||
data class ClearDownloaderPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun clearDownloader(input: ClearDownloaderInput): CompletableFuture<ClearDownloaderPayload> {
|
||||
@@ -224,11 +232,12 @@ class DownloadMutation {
|
||||
DownloadManager.clear()
|
||||
ClearDownloaderPayload(
|
||||
input.clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Stopped && it.queue.isEmpty() }
|
||||
)
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.status == Status.Stopped && it.queue.isEmpty() },
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -236,11 +245,12 @@ class DownloadMutation {
|
||||
data class ReorderChapterDownloadInput(
|
||||
val clientMutationId: String? = null,
|
||||
val chapterId: Int,
|
||||
val to: Int
|
||||
val to: Int,
|
||||
)
|
||||
|
||||
data class ReorderChapterDownloadPayload(
|
||||
val clientMutationId: String?,
|
||||
val downloadStatus: DownloadStatus
|
||||
val downloadStatus: DownloadStatus,
|
||||
)
|
||||
|
||||
fun reorderChapterDownload(input: ReorderChapterDownloadInput): CompletableFuture<ReorderChapterDownloadPayload> {
|
||||
@@ -250,11 +260,12 @@ class DownloadMutation {
|
||||
return future {
|
||||
ReorderChapterDownloadPayload(
|
||||
clientMutationId,
|
||||
downloadStatus = withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.queue.indexOfFirst { it.chapter.id == chapter } <= to }
|
||||
)
|
||||
}
|
||||
downloadStatus =
|
||||
withTimeout(30.seconds) {
|
||||
DownloadStatus(
|
||||
DownloadManager.status.first { it.queue.indexOfFirst { it.chapter.id == chapter } <= to },
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -262,7 +273,7 @@ class DownloadMutation {
|
||||
data class DownloadAheadInput(
|
||||
val clientMutationId: String? = null,
|
||||
val mangaIds: List<Int> = emptyList(),
|
||||
val latestReadChapterIds: List<Int>? = null
|
||||
val latestReadChapterIds: List<Int>? = null,
|
||||
)
|
||||
|
||||
data class DownloadAheadPayload(val clientMutationId: String?)
|
||||
|
||||
Reference in New Issue
Block a user