Class: CommandTower::Workflows::Messaging::Inbox::ListWorkflow

Inherits:
BaseWorkflow show all
Defined in:
app/workflows/command_tower/workflows/messaging/inbox.rb

Constant Summary

Constants inherited from ApplicationWorkflow

ApplicationWorkflow::ALLOWED_RETRY_STRATEGIES, ApplicationWorkflow::InvalidTransactionResult, ApplicationWorkflow::TransactionFailure

Instance Method Summary collapse

Methods inherited from BaseWorkflow

inherited

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

included

Methods included from Logging::LifecycleDeclaration

included

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(user:, limit:, offset:, scope:) ⇒ Object



25
26
27
28
29
30
31
32
# File 'app/workflows/command_tower/workflows/messaging/inbox.rb', line 25

def call(user:, limit:, offset:, scope:)
  result = CommandTower::Services::Messaging::Inbox::List.call(user:, limit:, offset:, scope:)
  return result_or_failure(result) unless result.success?

  payload = result.data[:items].map { |item| CommandTower::Serializers::Messaging::Inbox::ItemSerializer.serialize(item) }
  meta = CommandTower::Serializers::Messaging::Inbox::PaginationMetaSerializer.serialize(result.data[:pagination])
  success(payload:, meta:, http_status: :ok)
end