feat(config): add GameWritebackEventDtoMixin for JSON deserialization
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package de.nowchess.store.config
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
||||||
|
|
||||||
|
abstract class GameWritebackEventDtoMixin:
|
||||||
|
@JsonDeserialize(contentAs = classOf[java.lang.Long]) val whiteRemainingMs: Option[Long]
|
||||||
|
@JsonDeserialize(contentAs = classOf[java.lang.Long]) val blackRemainingMs: Option[Long]
|
||||||
|
@JsonDeserialize(contentAs = classOf[java.lang.Long]) val incrementMs: Option[Long]
|
||||||
|
@JsonDeserialize(contentAs = classOf[java.lang.Long]) val clockLastTickAt: Option[Long]
|
||||||
|
@JsonDeserialize(contentAs = classOf[java.lang.Long]) val clockMoveDeadline: Option[Long]
|
||||||
@@ -3,6 +3,7 @@ package de.nowchess.store.config
|
|||||||
import com.fasterxml.jackson.core.Version
|
import com.fasterxml.jackson.core.Version
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.fasterxml.jackson.module.scala.DefaultScalaModule
|
import com.fasterxml.jackson.module.scala.DefaultScalaModule
|
||||||
|
import de.nowchess.api.dto.GameWritebackEventDto
|
||||||
import io.quarkus.jackson.ObjectMapperCustomizer
|
import io.quarkus.jackson.ObjectMapperCustomizer
|
||||||
import jakarta.inject.Singleton
|
import jakarta.inject.Singleton
|
||||||
|
|
||||||
@@ -15,3 +16,4 @@ class JacksonConfig extends ObjectMapperCustomizer:
|
|||||||
new Version(2, 21, 1, null, "com.fasterxml.jackson.module", "jackson-module-scala")
|
new Version(2, 21, 1, null, "com.fasterxml.jackson.module", "jackson-module-scala")
|
||||||
// scalafix:on DisableSyntax.null
|
// scalafix:on DisableSyntax.null
|
||||||
})
|
})
|
||||||
|
mapper.addMixIn(classOf[GameWritebackEventDto], classOf[GameWritebackEventDtoMixin])
|
||||||
|
|||||||
Reference in New Issue
Block a user