Class: Uchi::Actions::ExecutionsController

Inherits:
Uchi::ApplicationController show all
Defined in:
app/controllers/uchi/actions/executions_controller.rb

Overview

Controller for creating action executions on repository records.

This controller handles POST requests to execute actions registered on repositories. It finds the appropriate action, loads the records, executes the action, and handles the response.

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/uchi/actions/executions_controller.rb', line 11

def create
  repository = find_repository
  action = find_action(repository: repository)
  action.context = uchi_context
  input = build_input(action: action)
  records = find_records(repository: repository)

  response = action.perform(records, input)
  response = default_response unless response.is_a?(Uchi::ActionResponse)
  handle_response(response: response, repository: repository)
end