parent
3fd398879e
commit
b6f4006c15
8 changed files with 46 additions and 7 deletions
|
@ -10,20 +10,16 @@ class Platform::Api::V1::UsersController < PlatformController
|
|||
@resource.confirm
|
||||
@resource.save!
|
||||
@platform_app.platform_app_permissibles.find_or_create_by(permissible: @resource)
|
||||
render json: @resource
|
||||
end
|
||||
|
||||
def login
|
||||
render json: { url: "#{ENV['FRONTEND_URL']}/app/login?email=#{@resource.email}&sso_auth_token=#{@resource.generate_sso_auth_token}" }
|
||||
end
|
||||
|
||||
def show
|
||||
render json: @resource
|
||||
end
|
||||
def show; end
|
||||
|
||||
def update
|
||||
@resource.update!(user_params)
|
||||
render json: @resource
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
23
app/views/platform/api/v1/models/_user.json.jbuilder
Normal file
23
app/views/platform/api/v1/models/_user.json.jbuilder
Normal file
|
@ -0,0 +1,23 @@
|
|||
json.access_token resource.access_token.token
|
||||
json.account_id resource.active_account_user&.account_id
|
||||
json.availability_status resource.availability_status
|
||||
json.available_name resource.available_name
|
||||
json.avatar_url resource.avatar_url
|
||||
json.confirmed resource.confirmed?
|
||||
json.display_name resource.display_name
|
||||
json.email resource.email
|
||||
json.id resource.id
|
||||
json.name resource.name
|
||||
json.provider resource.provider
|
||||
json.pubsub_token resource.pubsub_token
|
||||
json.role resource.active_account_user&.role
|
||||
json.ui_settings resource.ui_settings
|
||||
json.uid resource.uid
|
||||
json.accounts do
|
||||
json.array! resource.account_users do |account_user|
|
||||
json.id account_user.account_id
|
||||
json.name account_user.account.name
|
||||
json.active_at account_user.active_at
|
||||
json.role account_user.role
|
||||
end
|
||||
end
|
1
app/views/platform/api/v1/users/create.json.jbuilder
Normal file
1
app/views/platform/api/v1/users/create.json.jbuilder
Normal file
|
@ -0,0 +1 @@
|
|||
json.partial! 'platform/api/v1/models/user.json.jbuilder', resource: @resource
|
1
app/views/platform/api/v1/users/show.json.jbuilder
Normal file
1
app/views/platform/api/v1/users/show.json.jbuilder
Normal file
|
@ -0,0 +1 @@
|
|||
json.partial! 'platform/api/v1/models/user.json.jbuilder', resource: @resource
|
1
app/views/platform/api/v1/users/update.json.jbuilder
Normal file
1
app/views/platform/api/v1/users/update.json.jbuilder
Normal file
|
@ -0,0 +1 @@
|
|||
json.partial! 'platform/api/v1/models/user.json.jbuilder', resource: @resource
|
|
@ -1,6 +1,6 @@
|
|||
# DO NOT change the order of features EVER
|
||||
- name: inbound_emails
|
||||
enabled: false
|
||||
enabled: true
|
||||
- name: channel_email
|
||||
enabled: true
|
||||
- name: channel_facebook
|
||||
|
|
17
db/migrate/20210315101919_enable_email_channel.rb
Normal file
17
db/migrate/20210315101919_enable_email_channel.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class EnableEmailChannel < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
current_config = InstallationConfig.where(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS').last
|
||||
current_config.value.each { |v| v['enabled'] = true if %w[inbound_emails channel_email].include?(v['name']) }
|
||||
current_config.save!
|
||||
|
||||
ConfigLoader.new.process
|
||||
|
||||
Account.find_in_batches do |account_batch|
|
||||
account_batch.each do |account|
|
||||
account.enable_features('inbound_emails')
|
||||
account.enable_features('channel_email')
|
||||
account.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_03_03_192243) do
|
||||
ActiveRecord::Schema.define(version: 2021_03_15_101919) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
|
|
Loading…
Reference in a new issue