diff --git a/CHANGELOG.md b/CHANGELOG.md index d0eadd3e75..b064d1c9a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +- Fix a bug: unable to reset OpenApi token + ## v6.3.32 2024 July 22 - Fix a bug: manager cannot pay a subscription(payment schedule) with a wallet diff --git a/app/models/open_api/client.rb b/app/models/open_api/client.rb index 9d537d379c..80e1eabf0d 100644 --- a/app/models/open_api/client.rb +++ b/app/models/open_api/client.rb @@ -3,16 +3,16 @@ # OpenAPI::Client keeps track of the authorized accesses to the 3-rd party API (aka. OpenAPI) class OpenAPI::Client < ApplicationRecord validates :name, presence: true - validates_uniqueness_of :token + validates :token, uniqueness: true before_create :set_initial_token def increment_calls_count - update_column(:calls_count, calls_count+1) + update_column(:calls_count, calls_count + 1) end def regenerate_token - update_attributes(token: generate_unique_secure_token) + update(token: generate_unique_secure_token) end private