future proofed SyncID

This commit is contained in:
Blatzar 2023-01-28 23:36:24 +01:00
parent cd166cb0d3
commit df95931d0a
3 changed files with 9 additions and 5 deletions

View File

@ -138,7 +138,11 @@ interface SyncAPI : OAuth2API {
data class LibraryItem(
override val name: String,
override val url: String,
/** Unique unchanging string used for data storage */
/**
* Unique unchanging string used for data storage.
* This should be the actual id when you change scores and status
* since score changes from library might get added in the future.
**/
val syncId: String,
val episodesCompleted: Int?,
val episodesTotal: Int?,

View File

@ -72,7 +72,7 @@ class LocalList : SyncAPI {
it.second.stringRes
}.mapValues { group ->
group.value.mapNotNull {
getBookmarkedData(it.first)?.toLibraryItem()
getBookmarkedData(it.first)?.toLibraryItem(it.first.toString())
}
}
}

View File

@ -55,16 +55,16 @@ object DataStoreHelper {
@JsonProperty("quality") override var quality: SearchQuality? = null,
@JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>? = null,
) : SearchResponse {
fun toLibraryItem(): SyncAPI.LibraryItem {
fun toLibraryItem(id: String): SyncAPI.LibraryItem {
return SyncAPI.LibraryItem(
name,
url,
url,
id,
null,
null,
null,
null,
apiName, type, posterUrl, posterHeaders, quality, id
apiName, type, posterUrl, posterHeaders, quality, this.id
)
}
}