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
677 B
26 lines
677 B
# frozen_string_literal: true
|
|
|
|
module Api
|
|
class SignedDocumentUrlsController < ApiBaseController
|
|
load_and_authorize_resource :submission
|
|
|
|
def show
|
|
last_submitter = @submission.last_completed_submitter
|
|
|
|
if last_submitter.blank?
|
|
return render json: { error: 'Submission not completed' },
|
|
status: :unprocessable_entity
|
|
end
|
|
|
|
# Ensure documents are generated
|
|
Submissions::EnsureResultGenerated.call(last_submitter)
|
|
|
|
render json: {
|
|
submission_id: @submission.id,
|
|
submitter_id: last_submitter.id,
|
|
documents: SignedDocumentUrlBuilder.new(last_submitter).call
|
|
}
|
|
end
|
|
end
|
|
end
|