mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
629 B
26 lines
629 B
# frozen_string_literal: true
|
|
|
|
class SubmissionsDownloadController < ApplicationController
|
|
load_and_authorize_resource :submission
|
|
|
|
def index
|
|
last_submitter = @submission.submitters.where.not(completed_at: nil).order(:completed_at).last
|
|
|
|
return head :not_found unless last_submitter
|
|
|
|
Submissions::EnsureResultGenerated.call(last_submitter)
|
|
|
|
if params[:combined] == 'true'
|
|
url = Submitters.build_combined_url(last_submitter)
|
|
|
|
if url
|
|
render json: [url]
|
|
else
|
|
head :not_found
|
|
end
|
|
else
|
|
render json: Submitters.build_document_urls(last_submitter)
|
|
end
|
|
end
|
|
end
|