mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-07 21:04:34 -05:00
Add mutation to bind existing track record (#2045)
Makes it possible to copy a bound track record to another manga. This is necessary during a migration to prevent spamming the actual tracker and causing 429 errors closes #2033
This commit is contained in:
@@ -148,6 +148,36 @@ 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(
|
||||
val clientMutationId: String? = null,
|
||||
val recordId: Int,
|
||||
|
||||
Reference in New Issue
Block a user