Class: V0::InProgressFormsController

Inherits:
ApplicationController show all
Includes:
IgnoreNotFound
Defined in:
app/controllers/v0/in_progress_forms_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::VERSION_STATUS

Constants included from SignIn::Authentication

SignIn::Authentication::BEARER_PATTERN

Constants included from ExceptionHandling

ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES

Instance Method Summary collapse

Methods included from IgnoreNotFound

#skip_sentry_exception_types

Methods inherited from ApplicationController

#clear_saved_form, #cors_preflight, #routing_error

Methods included from Traceable

#set_trace_tags

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods included from SignIn::Authentication

#authenticate, #authenticate_service_account, #load_user

Methods included from Headers

#block_unknown_hosts, #set_app_info_headers

Methods included from AuthenticationAndSSOConcerns

#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_session_expiration_header, #sso_logging_info, #validate_inbound_login_params, #validate_session

Instance Method Details

#destroyObject



30
31
32
33
34
35
# File 'app/controllers/v0/in_progress_forms_controller.rb', line 30

def destroy
  raise Common::Exceptions::RecordNotFound, form_id if form_for_user.blank?

  form_for_user.destroy
  render json: form_for_user, key_transform: :unaltered
end

#indexObject



8
9
10
11
12
# File 'app/controllers/v0/in_progress_forms_controller.rb', line 8

def index
  # :unaltered prevents the keys from being deeply transformed, which might corrupt some keys
  # see https://github.com/department-of-veterans-affairs/va.gov-team/issues/17595 for more details
  render json: InProgressForm.for_user(@current_user), key_transform: :unaltered
end

#showObject



14
15
16
# File 'app/controllers/v0/in_progress_forms_controller.rb', line 14

def show
  render json: form_for_user&. || camelized_prefill_for_user
end

#updateObject



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/v0/in_progress_forms_controller.rb', line 18

def update
  form = InProgressForm.form_for_user(form_id, @current_user) ||
         InProgressForm.new(form_id:, user_uuid: @current_user.uuid)
  form. = @current_user.
  form.real_user_uuid = @current_user.uuid

  ClaimFastTracking::MaxCfiMetrics.log_form_update(form, params)

  form.update!(form_data: params[:form_data] || params[:formData], metadata: params[:metadata])
  render json: form, key_transform: :unaltered
end