Class: CommandTower::Workflows::Me::DeleteAccountWorkflow
- Inherits:
-
ApplicationWorkflow
- Object
- ApplicationWorkflow
- CommandTower::Workflows::Me::DeleteAccountWorkflow
- Defined in:
- app/workflows/command_tower/workflows/me/delete_account_workflow.rb
Constant Summary
Constants inherited from ApplicationWorkflow
ApplicationWorkflow::ALLOWED_RETRY_STRATEGIES, ApplicationWorkflow::InvalidTransactionResult, ApplicationWorkflow::TransactionFailure
Instance Method Summary collapse
Methods inherited from ApplicationWorkflow
call, call_from_job, continuation_max_attempts, declared_retry_strategy, mark_impersonation_activity!, retry_strategy, validate_retry_strategy!
Methods included from Impersonation::ActivityDeclaration
Methods included from Logging::LifecycleDeclaration
Methods included from Execution::ContextAccess
#audit, #execution_context, #log_debug, #log_error, #log_info, #log_warn, #publish_event
Methods included from Transactional
#fail_transaction!, #transaction
Instance Method Details
#call(current_user:, password:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/workflows/command_tower/workflows/me/delete_account_workflow.rb', line 9 def call(current_user:, password:) delete_result = CommandTower::Services::Me::DeleteAccount.call( user: current_user, password: ) unless delete_result.success? error = delete_result.errors.first return failure( errors: delete_result.errors, http_status: CommandTower::Workflows::Me::ErrorStatus.http_status_for(error) ) end success( payload: CommandTower::Serializers::Me::DeleteAccountResponseSerializer.serialize( message: delete_result.data[:message] ), http_status: :ok, response_effects: { clear_token: true } ) end |