Class: CommandTower::Me::PreferencesController

Inherits:
ApplicationController show all
Includes:
Auth::AuthenticationBoundary, Auth::AuthorizationBoundary
Defined in:
app/controllers/command_tower/me/preferences_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::AUTHENTICATION_EXPIRE_HEADER, ApplicationController::AUTHENTICATION_HEADER, ApplicationController::AUTHENTICATION_WITH_RESET

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user!, #authenticate_user_without_email_verification!, #authorize_user!, #current_user, #safe_boolean

Instance Method Details

#showObject



12
13
14
15
16
17
18
19
# File 'app/controllers/command_tower/me/preferences_controller.rb', line 12

def show
  deserialized = CommandTower::Deserializers::Messaging::Preferences::ShowDeserializer.call(params)
  return render_deserializer_errors unless deserialized.success?

  render_application_result(
    CommandTower::Workflows::Messaging::Preferences::ShowWorkflow.call(user: current_user)
  )
end

#updateObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/command_tower/me/preferences_controller.rb', line 21

def update
  deserialized = CommandTower::Deserializers::Messaging::Preferences::UpdateDeserializer.call(params)
  return render_deserializer_errors unless deserialized.success?

  render_application_result(
    CommandTower::Workflows::Messaging::Preferences::UpdateWorkflow.call(
      user: current_user,
      notification_type_key: deserialized.input.notification_type_key,
      preference_state: deserialized.input.preference_state,
    )
  )
end