summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
blob: 4fc614c5679c5341d9b8fdb82b038aaa9053a310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

# The father class of all controllers.
class ApplicationController < ActionController::API
  before_action do
    ActiveStorage::Current.url_options = { protocol: request.protocol, host: request.host, port: request.port }
  end

  def logic(permitted_params)
    @logic = Object.const_get("#{self.class}::#{action_name.camelize}Logic").new(permitted_params)
  end

  private

  def generate_token
    Services::TokenGenerationService.new(service_params).call(DateTime.current + 5.days)
  end
end