Module: CommandTower::Services::Messaging::Inbox

Defined in:
app/services/command_tower/services/messaging/inbox.rb

Defined Under Namespace

Modules: BulkMutation, FailureMapping Classes: Archive, Delete, List, Open, Show, UnreadCount

Class Method Summary collapse

Class Method Details

.detail(recipient_id:, inbox_item_id:) ⇒ Object



118
119
120
121
122
123
124
# File 'app/services/command_tower/services/messaging/inbox.rb', line 118

def detail(recipient_id:, inbox_item_id:)
  item = CommandTower::Messaging::Inbox.show(recipient_id:, inbox_item_id:)
  communication = CommandTower::Messaging::Contract::Communications.find(
    CommandTower::Messaging::Contract::Requests::FindCommunication.build(communication_id: item.communication_id, recipient_id:)
  )
  item(item).merge(body: communication.body, metadata: communication., notification_type_key: communication.notification_type_key)
end

.item(item) ⇒ Object



114
115
116
# File 'app/services/command_tower/services/messaging/inbox.rb', line 114

def item(item)
  { id: item.id, title: item.title, status: item.status, viewed_at: item.viewed_at, created_at: item.created_at, updated_at: item.updated_at }
end