From a889b48bd1b5e8174397a9783dc6cb64e13c21ad Mon Sep 17 00:00:00 2001 From: gowthaman Date: Thu, 9 May 2024 14:16:09 +0530 Subject: [PATCH] fix product edit --- src/main/kotlin/com/restapi/config/Auth.kt | 11 +---------- src/main/kotlin/com/restapi/domain/models.kt | 2 -- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/main/kotlin/com/restapi/config/Auth.kt b/src/main/kotlin/com/restapi/config/Auth.kt index a0f5039..20bf22e 100644 --- a/src/main/kotlin/com/restapi/config/Auth.kt +++ b/src/main/kotlin/com/restapi/config/Auth.kt @@ -189,7 +189,6 @@ object Auth { this.expiresAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()) this.refreshToken = atResponse.refreshToken this.refreshExpiresAt = LocalDateTime.now().plusSeconds(atResponse.refreshExpiresIn.toLong()) - this.refreshHistory = arrayListOf() }) ctx.result(atResponse.accessToken).contentType(ContentType.TEXT_PLAIN) } @@ -273,15 +272,7 @@ object Auth { foundOldAt.expiresAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()) foundOldAt.refreshExpiresAt = LocalDateTime.now().plusSeconds(atResponse.refreshExpiresIn.toLong()) foundOldAt.refreshToken = atResponse.refreshToken - foundOldAt.refreshHistory = (foundOldAt.refreshHistory ?: arrayListOf()).apply { - 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) ctx.result(atResponse.accessToken).contentType(ContentType.TEXT_PLAIN) diff --git a/src/main/kotlin/com/restapi/domain/models.kt b/src/main/kotlin/com/restapi/domain/models.kt index 661bc05..355a38b 100644 --- a/src/main/kotlin/com/restapi/domain/models.kt +++ b/src/main/kotlin/com/restapi/domain/models.kt @@ -709,6 +709,4 @@ open class AuthTokenCache : BaseModel() { var expired: Boolean = false var loggedOut: Boolean = false - @DbJsonB - var refreshHistory: MutableList? = arrayListOf() } \ No newline at end of file