about summary refs log tree commit diff
path: root/app/controllers/api/v1
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2020-09-02 09:13:10 +0900
committerGitHub <noreply@github.com>2020-09-02 02:13:10 +0200
commit33ad850c982bbe03214e2e2870751920721c23af (patch)
tree99d4cf909c77a3310a6e029d9751a897c5e7146f /app/controllers/api/v1
parent17340365bbf057314d3cb19ec20c5d74b52c6395 (diff)
Added account featured tags API (#11817)
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r--app/controllers/api/v1/accounts/featured_tags_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/api/v1/accounts/featured_tags_controller.rb b/app/controllers/api/v1/accounts/featured_tags_controller.rb
new file mode 100644
index 000000000..d6277261d
--- /dev/null
+++ b/app/controllers/api/v1/accounts/featured_tags_controller.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class Api::V1::Accounts::FeaturedTagsController < Api::BaseController
+  before_action :set_account
+  before_action :set_featured_tags
+
+  respond_to :json
+
+  def index
+    render json: @featured_tags, each_serializer: REST::AccountFeaturedTagSerializer
+  end
+
+  private
+
+  def set_account
+    @account = Account.find(params[:account_id])
+  end
+
+  def set_featured_tags
+    @featured_tags = @account.featured_tags
+  end
+end