suggestions_controller.rb 600 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. class Api::V1::SuggestionsController < Api::BaseController
  3. include Authorization
  4. before_action -> { doorkeeper_authorize! :read }
  5. before_action :require_user!
  6. def index
  7. suggestions = suggestions_source.get(current_account, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
  8. render json: suggestions.map(&:account), each_serializer: REST::AccountSerializer
  9. end
  10. def destroy
  11. suggestions_source.remove(current_account, params[:id])
  12. render_empty
  13. end
  14. private
  15. def suggestions_source
  16. AccountSuggestions::PastInteractionsSource.new
  17. end
  18. end