diff --git a/src/main/kotlin/com/restapi/config/Auth.kt b/src/main/kotlin/com/restapi/config/Auth.kt index 8fc6584..94f145d 100644 --- a/src/main/kotlin/com/restapi/config/Auth.kt +++ b/src/main/kotlin/com/restapi/config/Auth.kt @@ -28,6 +28,7 @@ import java.net.http.HttpResponse import java.nio.charset.StandardCharsets import java.time.LocalDateTime import java.time.ZoneId +import java.time.format.DateTimeFormatter import java.util.* import java.util.concurrent.ConcurrentHashMap @@ -275,10 +276,10 @@ object Auth { foundOldAt.refreshHistory = (foundOldAt.refreshHistory ?: arrayListOf()).apply { add(RefreshHistory( oldAt = authUser.token, - oldExpiryAt = expiresAt, + oldExpiryAt = expiresAt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), newAt = atResponse.accessToken, - newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()), - createdAt = LocalDateTime.now() + newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), + createdAt = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), )) } database.update(foundOldAt) diff --git a/src/main/kotlin/com/restapi/domain/models.kt b/src/main/kotlin/com/restapi/domain/models.kt index 37c212a..f4d9af0 100644 --- a/src/main/kotlin/com/restapi/domain/models.kt +++ b/src/main/kotlin/com/restapi/domain/models.kt @@ -690,10 +690,10 @@ open class Plant : BaseModel() { data class RefreshHistory( val oldAt: String, - val oldExpiryAt: LocalDateTime, + val oldExpiryAt: String, val newAt: String, - val newExpiryAt: LocalDateTime, - val createdAt: LocalDateTime + val newExpiryAt: String, + val createdAt: String ) @Entity open class AuthTokenCache : BaseModel() {