fix product edit

This commit is contained in:
gowthaman 2024-05-09 13:56:59 +05:30
parent 7d99a11e14
commit 1e02deb1b1
2 changed files with 14 additions and 14 deletions

View File

@ -274,13 +274,13 @@ object Auth {
foundOldAt.refreshExpiresAt = LocalDateTime.now().plusSeconds(atResponse.refreshExpiresIn.toLong()) foundOldAt.refreshExpiresAt = LocalDateTime.now().plusSeconds(atResponse.refreshExpiresIn.toLong())
foundOldAt.refreshToken = atResponse.refreshToken foundOldAt.refreshToken = atResponse.refreshToken
foundOldAt.refreshHistory = (foundOldAt.refreshHistory ?: arrayListOf()).apply { foundOldAt.refreshHistory = (foundOldAt.refreshHistory ?: arrayListOf()).apply {
add(RefreshHistory( add(RefreshHistory().apply {
oldAt = authUser.token, oldAt = authUser.token
oldExpiryAt = expiresAt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), oldExpiryAt = expiresAt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
newAt = atResponse.accessToken, newAt = atResponse.accessToken
newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), newExpiryAt = LocalDateTime.now().plusSeconds(atResponse.expiresIn.toLong()).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
createdAt = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME), this.createdAt = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
)) })
} }
database.update(foundOldAt) database.update(foundOldAt)

View File

@ -688,13 +688,13 @@ open class Plant : BaseModel() {
var prefixes: MutableMap<String, String>? = mutableMapOf() var prefixes: MutableMap<String, String>? = mutableMapOf()
} }
data class RefreshHistory( class RefreshHistory {
val oldAt: String, var oldAt: String = ""
val oldExpiryAt: String, var oldExpiryAt: String = ""
val newAt: String, var newAt: String = ""
val newExpiryAt: String, var newExpiryAt: String = ""
val createdAt: String var createdAt: String = ""
) }
@Entity @Entity
open class AuthTokenCache : BaseModel() { open class AuthTokenCache : BaseModel() {
@Column(columnDefinition = "text") @Column(columnDefinition = "text")