Class: CommandTower::Me::InboxController

Inherits:
ApplicationController show all
Includes:
Auth::AuthenticationBoundary, Auth::AuthorizationBoundary
Defined in:
app/controllers/command_tower/me/inbox_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

#archiveObject



29
30
31
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 29

def archive
  run_item_workflow(CommandTower::Workflows::Messaging::Inbox::ArchiveWorkflow)
end

#bulk_archiveObject



49
50
51
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 49

def bulk_archive
  run_bulk_workflow(CommandTower::Workflows::Messaging::Inbox::BulkArchiveWorkflow)
end

#bulk_deleteObject



57
58
59
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 57

def bulk_delete
  run_bulk_workflow(CommandTower::Workflows::Messaging::Inbox::BulkDeleteWorkflow)
end

#bulk_readObject



41
42
43
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 41

def bulk_read
  run_bulk_workflow(CommandTower::Workflows::Messaging::Inbox::BulkReadWorkflow)
end

#bulk_restoreObject



53
54
55
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 53

def bulk_restore
  run_bulk_workflow(CommandTower::Workflows::Messaging::Inbox::BulkRestoreWorkflow)
end

#bulk_unreadObject



45
46
47
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 45

def bulk_unread
  run_bulk_workflow(CommandTower::Workflows::Messaging::Inbox::BulkUnreadWorkflow)
end

#destroyObject



33
34
35
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 33

def destroy
  run_item_workflow(CommandTower::Workflows::Messaging::Inbox::DeleteWorkflow)
end

#indexObject



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

def index
  deserialized = CommandTower::Deserializers::Messaging::Inbox::ListDeserializer.call(params)
  return render_deserializer_errors unless deserialized.success?

  render_application_result(CommandTower::Workflows::Messaging::Inbox::ListWorkflow.call(
    user: current_user, limit: deserialized.input.limit, offset: deserialized.input.offset, scope: deserialized.input.scope
  ))
end

#openObject



25
26
27
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 25

def open
  run_item_workflow(CommandTower::Workflows::Messaging::Inbox::OpenWorkflow)
end

#showObject



21
22
23
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 21

def show
  run_item_workflow(CommandTower::Workflows::Messaging::Inbox::ShowWorkflow)
end

#unread_countObject



37
38
39
# File 'app/controllers/command_tower/me/inbox_controller.rb', line 37

def unread_count
  render_application_result(CommandTower::Workflows::Messaging::Inbox::UnreadCountWorkflow.call(user: current_user))
end