Class: Tasks::Projects::DataController

Inherits:
ApplicationController
  • Object
show all
Includes:
TaskControllerConfiguration
Defined in:
app/controllers/tasks/projects/data_controller.rb

Instance Method Summary collapse

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

#indexObject

GET task/projects/data



5
6
7
8
9
10
11
12
# File 'app/controllers/tasks/projects/data_controller.rb', line 5

def index
  allowed_types = ['Download::ProjectDump::Tsv', 'Download::ProjectDump::Sql']

  @project = Project.find(sessions_current_project_id)
  @recent_objects = Download.where(project_id: sessions_current_project_id, type: allowed_types)
    .order(created_at: :desc)
    .limit(10)
end

#sql_downloadObject



14
15
16
17
18
# File 'app/controllers/tasks/projects/data_controller.rb', line 14

def sql_download
  custom_password = params[:custom_password].presence
  download = ::Export::ProjectData::Sql.download_async(sessions_current_project, custom_password: custom_password)
  redirect_to download_path(download)
end

#tsv_downloadObject



20
21
22
23
# File 'app/controllers/tasks/projects/data_controller.rb', line 20

def tsv_download
  download = ::Export::ProjectData::Tsv.download_async(sessions_current_project)
  redirect_to file_download_path(download)
end