add trackers support (#720)

* add trackers support

* Cleanup Tracker Code

* Add GraphQL support for Tracking

* Fix lint and deprecation errors

* remove password from logs

* Fixes after merge

* Disable tracking for now

* More disabled

---------

Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
Tachimanga
2024-01-08 04:07:41 +08:00
committed by GitHub
parent 230427e758
commit 5a178ada74
44 changed files with 3726 additions and 10 deletions

View File

@@ -42,6 +42,7 @@ data class MangaDataClass(
var lastChapterRead: ChapterDataClass? = null,
val age: Long? = if (lastFetchedAt == null) 0 else Instant.now().epochSecond.minus(lastFetchedAt),
val chaptersAge: Long? = if (chaptersLastFetchedAt == null) null else Instant.now().epochSecond.minus(chaptersLastFetchedAt),
val trackers: List<MangaTrackerDataClass>? = null,
)
data class PagedMangaListDataClass(

View File

@@ -0,0 +1,18 @@
package suwayomi.tachidesk.manga.model.dataclass
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
data class MangaTrackerDataClass(
val id: Int,
val name: String,
val icon: String,
val statusList: List<Int>,
val statusTextMap: Map<Int, String>,
val scoreList: List<String>,
val record: TrackRecordDataClass?,
)

View File

@@ -0,0 +1,25 @@
package suwayomi.tachidesk.manga.model.dataclass
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
data class TrackRecordDataClass(
val id: Int,
val mangaId: Int,
val syncId: Int,
val remoteId: Long,
val libraryId: Long?,
val title: String,
val lastChapterRead: Double,
val totalChapters: Int,
val status: Int,
val score: Double,
var scoreString: String? = null,
val remoteUrl: String,
val startDate: Long,
val finishDate: Long,
)

View File

@@ -0,0 +1,24 @@
package suwayomi.tachidesk.manga.model.dataclass
import kotlinx.serialization.Serializable
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
@Serializable
data class TrackSearchDataClass(
val syncId: Int,
val mediaId: Long,
val title: String,
val totalChapters: Int,
val trackingUrl: String,
val coverUrl: String,
val summary: String,
val publishingStatus: String,
val publishingType: String,
val startDate: String,
)

View File

@@ -0,0 +1,16 @@
package suwayomi.tachidesk.manga.model.dataclass
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
data class TrackerDataClass(
val id: Int,
val name: String,
val icon: String,
val isLogin: Boolean,
val authUrl: String?,
)

View File

@@ -0,0 +1,26 @@
package suwayomi.tachidesk.manga.model.table
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.ReferenceOption
object TrackRecordTable : IntIdTable() {
val mangaId = reference("manga_id", MangaTable, ReferenceOption.CASCADE)
val syncId = integer("sync_id")
val remoteId = long("remote_id")
val libraryId = long("library_id").nullable()
val title = varchar("title", 512)
val lastChapterRead = double("last_chapter_read")
val totalChapters = integer("total_chapters")
val status = integer("status")
val score = double("score")
val remoteUrl = varchar("remote_url", 512)
val startDate = long("start_date")
val finishDate = long("finish_date")
}