diff --git a/src/main/kotlin/com/restapi/config/Auth.kt b/src/main/kotlin/com/restapi/config/Auth.kt index 94f145d..a0f5039 100644 --- a/src/main/kotlin/com/restapi/config/Auth.kt +++ b/src/main/kotlin/com/restapi/config/Auth.kt @@ -274,13 +274,13 @@ object Auth { foundOldAt.refreshExpiresAt = LocalDateTime.now().plusSeconds(atResponse.refreshExpiresIn.toLong()) foundOldAt.refreshToken = atResponse.refreshToken foundOldAt.refreshHistory = (foundOldAt.refreshHistory ?: arrayListOf()).apply { - add(RefreshHistory( - oldAt = authUser.token, - oldExpiryAt = expiresAt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), - newAt = atResponse.accessToken, - newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), - createdAt = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), - )) + add(RefreshHistory().apply { + oldAt = authUser.token + oldExpiryAt = expiresAt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + newAt = atResponse.accessToken + newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + this.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 f4d9af0..661bc05 100644 --- a/src/main/kotlin/com/restapi/domain/models.kt +++ b/src/main/kotlin/com/restapi/domain/models.kt @@ -688,13 +688,13 @@ open class Plant : BaseModel() { var prefixes: MutableMap? = mutableMapOf() } -data class RefreshHistory( - val oldAt: String, - val oldExpiryAt: String, - val newAt: String, - val newExpiryAt: String, - val createdAt: String -) + class RefreshHistory { + var oldAt: String = "" + var oldExpiryAt: String = "" + var newAt: String = "" + var newExpiryAt: String = "" + var createdAt: String = "" + } @Entity open class AuthTokenCache : BaseModel() { @Column(columnDefinition = "text")