You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
602 B

  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::SearchController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read, :'read:accounts' }
  4. before_action :require_user!
  5. def show
  6. @accounts = account_search
  7. render json: @accounts, each_serializer: REST::AccountSerializer
  8. end
  9. private
  10. def account_search
  11. AccountSearchService.new.call(
  12. params[:q],
  13. current_account,
  14. limit: limit_param(DEFAULT_ACCOUNTS_LIMIT),
  15. resolve: truthy_param?(:resolve),
  16. following: truthy_param?(:following),
  17. offset: params[:offset]
  18. )
  19. end
  20. end