mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 04:22:28 +02:00
Fix serialization of KoboProxy objects
This commit is contained in:
parent
85edd8b63f
commit
a40e115c6a
7 changed files with 26 additions and 6 deletions
|
|
@ -590,8 +590,8 @@ class KoboController(
|
|||
null,
|
||||
locations =
|
||||
R2Locator.Location(
|
||||
progression = koboUpdate.currentBookmark.contentSourceProgressPercent / 100,
|
||||
totalProgression = koboUpdate.currentBookmark.progressPercent?.div(100),
|
||||
progression = koboUpdate.currentBookmark.contentSourceProgressPercent.toFloat() / 100,
|
||||
totalProgression = koboUpdate.currentBookmark.progressPercent?.toFloat()?.div(100),
|
||||
),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
|
|
@ -8,16 +9,17 @@ import java.time.ZonedDateTime
|
|||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class BookmarkDto(
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastModified: ZonedDateTime,
|
||||
/**
|
||||
* Total progression in the book.
|
||||
* Between 0 and 100.
|
||||
*/
|
||||
val progressPercent: Float? = null,
|
||||
val progressPercent: Int? = null,
|
||||
/**
|
||||
* Progression within the resource.
|
||||
* Between 0 and 100.
|
||||
*/
|
||||
val contentSourceProgressPercent: Float? = null,
|
||||
val contentSourceProgressPercent: Int? = null,
|
||||
val location: LocationDto? = null,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class LocationDto(
|
||||
/**
|
||||
* For type=KoboSpan values are in the form "kobo.x.y"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
import org.gotson.komga.domain.model.ReadProgress
|
||||
|
|
@ -7,14 +9,18 @@ import org.gotson.komga.language.toUTCZoned
|
|||
import java.time.ZonedDateTime
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class ReadingStateDto(
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val created: ZonedDateTime? = null,
|
||||
val currentBookmark: BookmarkDto,
|
||||
val entitlementId: String,
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastModified: ZonedDateTime,
|
||||
/**
|
||||
* From CW: apparently always equals to lastModified
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val priorityTimestamp: ZonedDateTime? = null,
|
||||
val statistics: StatisticsDto,
|
||||
val statusInfo: StatusInfoDto,
|
||||
|
|
@ -38,12 +44,14 @@ fun ReadProgress.toDto() =
|
|||
this.locator
|
||||
?.locations
|
||||
?.totalProgression
|
||||
?.times(100),
|
||||
?.times(100)
|
||||
?.toInt(),
|
||||
contentSourceProgressPercent =
|
||||
this.locator
|
||||
?.locations
|
||||
?.progression
|
||||
?.times(100),
|
||||
?.times(100)
|
||||
?.toInt(),
|
||||
location = this.locator?.let { LocationDto(source = it.href, value = it.koboSpan) },
|
||||
),
|
||||
statistics =
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
|
||||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class ReadingStateStateUpdateDto(
|
||||
val readingStates: Collection<ReadingStateDto> = emptyList(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
|
|
@ -8,6 +9,7 @@ import java.time.ZonedDateTime
|
|||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class StatisticsDto(
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastModified: ZonedDateTime,
|
||||
val remainingTimeMinutes: Int? = null,
|
||||
val spentReadingMinutes: Int? = null,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.gotson.komga.interfaces.api.kobo.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming
|
||||
|
|
@ -8,9 +9,12 @@ import java.time.ZonedDateTime
|
|||
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy::class)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
data class StatusInfoDto(
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastModified: ZonedDateTime,
|
||||
val status: StatusDto,
|
||||
val timesStartedReading: Int? = null,
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastTimeFinished: ZonedDateTime? = null,
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
val lastTimeStartedReading: ZonedDateTime? = null,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue