about summary refs log tree commit diff
path: root/app/controllers/api/v2/suggestions_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api/v2/suggestions_controller.rb')
-rw-r--r--app/controllers/api/v2/suggestions_controller.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/api/v2/suggestions_controller.rb b/app/controllers/api/v2/suggestions_controller.rb
new file mode 100644
index 000000000..35eb276c0
--- /dev/null
+++ b/app/controllers/api/v2/suggestions_controller.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class Api::V2::SuggestionsController < Api::BaseController
+  include Authorization
+
+  before_action -> { doorkeeper_authorize! :read }
+  before_action :require_user!
+  before_action :set_suggestions
+
+  def index
+    render json: @suggestions, each_serializer: REST::SuggestionSerializer
+  end
+
+  private
+
+  def set_suggestions
+    @suggestions = AccountSuggestions.get(current_account, limit_param(DEFAULT_ACCOUNTS_LIMIT))
+  end
+end