2018-08-22 03:07:45 +08:00
|
|
|
module TeamZipExporter
|
|
|
|
def self.generate_zip(params, team, current_user)
|
2018-09-30 22:37:18 +08:00
|
|
|
Rails.logger.info('Exporting team zip')
|
2018-08-22 03:07:45 +08:00
|
|
|
|
|
|
|
project_ids = params[:project_ids]
|
|
|
|
ids = Project.where(id: project_ids,
|
|
|
|
team_id: team)
|
2018-09-23 17:14:59 +08:00
|
|
|
.index_by(&:id)
|
2018-08-22 03:07:45 +08:00
|
|
|
|
2018-09-23 17:14:59 +08:00
|
|
|
options = { team: team }
|
2018-09-17 02:28:26 +08:00
|
|
|
zip = TeamZipExport.create(user: current_user)
|
|
|
|
zip.generate_exportable_zip(
|
2018-08-22 03:07:45 +08:00
|
|
|
current_user,
|
|
|
|
ids,
|
2018-10-15 05:53:51 +08:00
|
|
|
:team,
|
2018-08-22 03:07:45 +08:00
|
|
|
options
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|