class ApplicationController < ActionController::API
  before_action :authenticate_user

  def current_user
    @current_user
  end

  private

  def authenticate_user
    code = request.headers['X-Transfer-Code'] || request.headers['HTTP_X_TRANSFER_CODE']
    @current_user = User.find_by(inheritance_code: code)
  end
end
