feat: Add Platform APIs (#1456)

This commit is contained in:
Sojan Jose
2021-01-14 20:35:22 +05:30
committed by GitHub
parent 75c2a7cb2f
commit 7542330d61
25 changed files with 688 additions and 20 deletions

View File

@@ -0,0 +1,29 @@
class Platform::Api::V1::AccountUsersController < PlatformController
before_action :set_resource
before_action :validate_platform_app_permissible
def index
render json: @resource.account_users
end
def create
@account_user = @resource.account_users.find_or_initialize_by(user_id: account_user_params[:user_id])
@account_user.update!(account_user_params)
render json: @account_user
end
def destroy
@resource.account_users.find_by(user_id: account_user_params[:user_id])&.destroy
head :ok
end
private
def set_resource
@resource = Account.find(params[:account_id])
end
def account_user_params
params.permit(:user_id, :role)
end
end