chore: Data needed to store onboarding flow

This commit is contained in:
Sojan
2024-02-14 19:55:45 +05:30
parent 11886a4e5e
commit f9900947dc
4 changed files with 7 additions and 2 deletions
@@ -49,6 +49,9 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController
Rails.logger.info "[Agent#bulk_create] ignoring email #{email}, errors: #{e.record.errors}"
end
end
# remove onboarding_step key in present in Current account custom attributes
Current.account.custom_attributes.delete('onboarding_step')
Current.account.save!
head :ok
end
@@ -43,7 +43,7 @@ class Api::V1::AccountsController < Api::BaseController
def update
@account.assign_attributes(account_params.slice(:name, :locale, :domain, :support_email, :auto_resolve_duration))
@account.custom_attributes.merge!(custom_attributes_params)
@account.custom_attributes['onboarding_step'] = 'invite_team' if custom_attributes_params[:onboarding_step].present?
@account.save!
end
@@ -10,6 +10,7 @@ if resource.custom_attributes.present?
json.company_size resource.custom_attributes['company_size'] if resource.custom_attributes['company_size'].present?
json.timezone resource.custom_attributes['timezone'] if resource.custom_attributes['timezone'].present?
json.logo resource.custom_attributes['logo'] if resource.custom_attributes['logo'].present?
json.onboarding_step resource.custom_attributes['onboarding_step'] if resource.custom_attributes['onboarding_step'].present?
end
end
json.domain @account.domain
@@ -28,7 +28,8 @@ module Enterprise::Api::V2::AccountsController
'industry' => data[:industry],
'company_size' => data[:company_size],
'timezone' => data[:timezone],
'logo' => data[:logo]
'logo' => data[:logo],
'onboarding_step' => 'account_update'
)
)
end