ToolJet/app/controllers/data_sources_controller.rb

24 lines
627 B
Ruby
Raw Normal View History

2021-04-03 05:57:55 +00:00
class DataSourcesController < ApplicationController
def index
@data_sources = DataSource.where(app_id: params[:app_id])
end
2021-04-03 05:57:55 +00:00
def create
@data_source = DataSource.create(
name: params[:name],
kind: params[:kind],
options: params[:options],
app_id: params[:app_id]
)
end
2021-04-12 13:35:48 +00:00
def test_connection
service = DataSourceConnectionService.new params[:kind], params[:options]
service.process
render json: { status: 200 }
rescue StandardError => error
render json: { error: error }, status: 500
end
2021-04-03 05:57:55 +00:00
end