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.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							854 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							854 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
class SubmitFormValuesController < ApplicationController
 | 
						|
  skip_before_action :authenticate_user!
 | 
						|
  skip_authorization_check
 | 
						|
 | 
						|
  def index
 | 
						|
    submitter = Submitter.find_by!(slug: params[:submit_form_slug])
 | 
						|
 | 
						|
    return render json: {} if submitter.completed_at? || submitter.declined_at?
 | 
						|
    return render json: {} if submitter.submission.template&.archived_at? ||
 | 
						|
                              submitter.submission.archived_at? ||
 | 
						|
                              submitter.submission.expired?
 | 
						|
 | 
						|
    value = submitter.values[params['field_uuid']]
 | 
						|
    attachment = submitter.attachments.where(created_at: params[:after]..).find_by(uuid: value) if value.present?
 | 
						|
 | 
						|
    render json: {
 | 
						|
      value:,
 | 
						|
      attachment: attachment&.as_json(only: %i[uuid created_at], methods: %i[url filename content_type])
 | 
						|
    }, head: :ok
 | 
						|
  end
 | 
						|
end
 |