mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 14:58:27 +00:00
23 lines
627 B
Ruby
23 lines
627 B
Ruby
class DataSourcesController < ApplicationController
|
|
|
|
def index
|
|
@data_sources = DataSource.where(app_id: params[:app_id])
|
|
end
|
|
|
|
def create
|
|
@data_source = DataSource.create(
|
|
name: params[:name],
|
|
kind: params[:kind],
|
|
options: params[:options],
|
|
app_id: params[:app_id]
|
|
)
|
|
end
|
|
|
|
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
|
|
end
|