mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
Compare commits
1 Commits
renovate/o
...
renovate/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd50b667df |
@@ -13,7 +13,7 @@ polyglot = "25.0.3"
|
|||||||
settings = "1.3.0"
|
settings = "1.3.0"
|
||||||
twelvemonkeys = "3.13.1"
|
twelvemonkeys = "3.13.1"
|
||||||
graphqlkotlin = "10.0.0"
|
graphqlkotlin = "10.0.0"
|
||||||
xmlserialization = "0.91.3"
|
xmlserialization = "1.0.0"
|
||||||
ktlint = "1.8.0"
|
ktlint = "1.8.0"
|
||||||
koin = "4.2.2"
|
koin = "4.2.2"
|
||||||
moko = "0.26.4"
|
moko = "0.26.4"
|
||||||
@@ -72,7 +72,7 @@ exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "e
|
|||||||
exposed-javatime = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" }
|
exposed-javatime = { module = "org.jetbrains.exposed:exposed-java-time", version.ref = "exposed" }
|
||||||
exposed-kotlintime = { module = "org.jetbrains.exposed:exposed-kotlin-datetime", version.ref = "exposed" }
|
exposed-kotlintime = { module = "org.jetbrains.exposed:exposed-kotlin-datetime", version.ref = "exposed" }
|
||||||
exposed-json = { module = "org.jetbrains.exposed:exposed-json ", version.ref = "exposed" }
|
exposed-json = { module = "org.jetbrains.exposed:exposed-json ", version.ref = "exposed" }
|
||||||
postgres = "org.postgresql:postgresql:42.7.12"
|
postgres = "org.postgresql:postgresql:42.7.11"
|
||||||
h2 = "com.h2database:h2:2.4.240"
|
h2 = "com.h2database:h2:2.4.240"
|
||||||
hikaricp = "com.zaxxer:HikariCP:7.1.0"
|
hikaricp = "com.zaxxer:HikariCP:7.1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -148,36 +148,6 @@ class TrackMutation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BindTrackRecordInput(
|
|
||||||
val clientMutationId: String? = null,
|
|
||||||
val mangaId: Int,
|
|
||||||
val trackRecordId: Int,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class BindTrackRecordPayload(
|
|
||||||
val clientMutationId: String?,
|
|
||||||
val trackRecord: TrackRecordType,
|
|
||||||
)
|
|
||||||
|
|
||||||
@RequireAuth
|
|
||||||
fun bindTrackRecord(input: BindTrackRecordInput): CompletableFuture<BindTrackRecordPayload?> {
|
|
||||||
val (clientMutationId, mangaId, trackRecordId) = input
|
|
||||||
|
|
||||||
return future {
|
|
||||||
val boundTrackRecordId = Track.bindTrackRecord(mangaId, trackRecordId)
|
|
||||||
|
|
||||||
val trackRecord =
|
|
||||||
transaction {
|
|
||||||
TrackRecordTable.selectAll().where { TrackRecordTable.id eq boundTrackRecordId }.first()
|
|
||||||
}
|
|
||||||
|
|
||||||
BindTrackRecordPayload(
|
|
||||||
clientMutationId,
|
|
||||||
TrackRecordType(trackRecord),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class FetchTrackInput(
|
data class FetchTrackInput(
|
||||||
val clientMutationId: String? = null,
|
val clientMutationId: String? = null,
|
||||||
val recordId: Int,
|
val recordId: Int,
|
||||||
|
|||||||
@@ -238,7 +238,6 @@ object Manga {
|
|||||||
it[MangaTable.lastFetchedAt] = Instant.now().epochSecond
|
it[MangaTable.lastFetchedAt] = Instant.now().epochSecond
|
||||||
|
|
||||||
it[MangaTable.updateStrategy] = sManga.update_strategy.name
|
it[MangaTable.updateStrategy] = sManga.update_strategy.name
|
||||||
it[MangaTable.memo] = Json.encodeToString(sManga.memo)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package suwayomi.tachidesk.manga.impl.backup.proto.handlers
|
|||||||
* 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.source.model.UpdateStrategy
|
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import org.jetbrains.exposed.v1.core.ResultRow
|
import org.jetbrains.exposed.v1.core.ResultRow
|
||||||
import org.jetbrains.exposed.v1.core.SortOrder
|
import org.jetbrains.exposed.v1.core.SortOrder
|
||||||
import org.jetbrains.exposed.v1.core.and
|
import org.jetbrains.exposed.v1.core.and
|
||||||
@@ -77,7 +78,7 @@ object BackupMangaHandler {
|
|||||||
lastModifiedAt = mangaRow[MangaTable.lastModifiedAt],
|
lastModifiedAt = mangaRow[MangaTable.lastModifiedAt],
|
||||||
version = mangaRow[MangaTable.version],
|
version = mangaRow[MangaTable.version],
|
||||||
initialized = mangaRow[MangaTable.initialized],
|
initialized = mangaRow[MangaTable.initialized],
|
||||||
memo = mangaRow[MangaTable.memo].encodeToByteArray(),
|
memo = Json.encodeToString(mangaRow[MangaTable.memo]).encodeToByteArray(),
|
||||||
)
|
)
|
||||||
|
|
||||||
val mangaId = mangaRow[MangaTable.id].value
|
val mangaId = mangaRow[MangaTable.id].value
|
||||||
@@ -115,7 +116,6 @@ object BackupMangaHandler {
|
|||||||
sourceOrder = chapters.size - it[ChapterTable.sourceOrder],
|
sourceOrder = chapters.size - it[ChapterTable.sourceOrder],
|
||||||
lastModifiedAt = it[ChapterTable.lastModifiedAt],
|
lastModifiedAt = it[ChapterTable.lastModifiedAt],
|
||||||
version = it[ChapterTable.version],
|
version = it[ChapterTable.version],
|
||||||
memo = it[ChapterTable.memo].encodeToByteArray(),
|
|
||||||
).apply {
|
).apply {
|
||||||
if (flags.includeClientData) {
|
if (flags.includeClientData) {
|
||||||
this.meta = chapterToMeta[it[ChapterTable.id].value] ?: emptyMap()
|
this.meta = chapterToMeta[it[ChapterTable.id].value] ?: emptyMap()
|
||||||
|
|||||||
@@ -222,48 +222,6 @@ object Track {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bindTrackRecord(
|
|
||||||
mangaId: Int,
|
|
||||||
trackRecordId: Int,
|
|
||||||
): Int {
|
|
||||||
val (trackRecord, existingTrackRecord) =
|
|
||||||
transaction {
|
|
||||||
val trackRecord =
|
|
||||||
TrackRecordTable
|
|
||||||
.selectAll()
|
|
||||||
.where {
|
|
||||||
(TrackRecordTable.id eq trackRecordId)
|
|
||||||
}.first()
|
|
||||||
.toTrackRecordDataClass()
|
|
||||||
|
|
||||||
val existingTrackRecord =
|
|
||||||
TrackRecordTable
|
|
||||||
.selectAll()
|
|
||||||
.where {
|
|
||||||
(TrackRecordTable.mangaId eq mangaId) and (TrackRecordTable.trackerId eq trackRecord.trackerId)
|
|
||||||
}.firstOrNull()
|
|
||||||
?.toTrackRecordDataClass()
|
|
||||||
|
|
||||||
trackRecord to existingTrackRecord
|
|
||||||
}
|
|
||||||
|
|
||||||
val isAlreadyBoundToManga = trackRecord.mangaId == mangaId
|
|
||||||
if (isAlreadyBoundToManga) {
|
|
||||||
return trackRecordId
|
|
||||||
}
|
|
||||||
|
|
||||||
val hasRecordForTracker = existingTrackRecord != null
|
|
||||||
if (hasRecordForTracker) {
|
|
||||||
val updatedTrack = trackRecord.copy(id = existingTrackRecord.id, mangaId = mangaId).toTrack()
|
|
||||||
|
|
||||||
return updateTrackRecord(updatedTrack)
|
|
||||||
}
|
|
||||||
|
|
||||||
val newTrack = trackRecord.copy(mangaId = mangaId).toTrack()
|
|
||||||
|
|
||||||
return insertTrackRecord(newTrack)
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun refresh(recordId: Int) {
|
suspend fun refresh(recordId: Int) {
|
||||||
val recordDb =
|
val recordDb =
|
||||||
transaction {
|
transaction {
|
||||||
@@ -465,9 +423,9 @@ object Track {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateTrackRecord(track: Track): Int = updateTrackRecords(listOf(track)).first()
|
fun updateTrackRecord(track: Track) = updateTrackRecords(listOf(track))
|
||||||
|
|
||||||
fun updateTrackRecords(tracks: List<Track>): List<Int> =
|
fun updateTrackRecords(tracks: List<Track>) =
|
||||||
transaction {
|
transaction {
|
||||||
if (tracks.isNotEmpty()) {
|
if (tracks.isNotEmpty()) {
|
||||||
BatchUpdateStatement(TrackRecordTable)
|
BatchUpdateStatement(TrackRecordTable)
|
||||||
@@ -489,8 +447,6 @@ object Track {
|
|||||||
}.toExecutable()
|
}.toExecutable()
|
||||||
.execute(this@transaction)
|
.execute(this@transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracks.map { it.id!! }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun insertTrackRecord(track: Track): Int = insertTrackRecords(listOf(track)).first()
|
fun insertTrackRecord(track: Track): Int = insertTrackRecords(listOf(track)).first()
|
||||||
|
|||||||
Reference in New Issue
Block a user