about summary refs log tree commit diff
path: root/app/controllers/api/v1/admin/trends_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-10-14 20:44:59 +0200
committerGitHub <noreply@github.com>2021-10-14 20:44:59 +0200
commit07341e7aa60fe7c7d4f298136af99276820940e7 (patch)
tree0244c21262573d6a94868f8ce7dfa934fabccf1e /app/controllers/api/v1/admin/trends_controller.rb
parent959f7fc580050b37741c92b645b842e45017a010 (diff)
Add graphs and retention metrics to admin dashboard (#16829)
Diffstat (limited to 'app/controllers/api/v1/admin/trends_controller.rb')
-rw-r--r--app/controllers/api/v1/admin/trends_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/api/v1/admin/trends_controller.rb b/app/controllers/api/v1/admin/trends_controller.rb
new file mode 100644
index 000000000..e32ab5d2c
--- /dev/null
+++ b/app/controllers/api/v1/admin/trends_controller.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class Api::V1::Admin::TrendsController < Api::BaseController
+  before_action :require_staff!
+  before_action :set_trends
+
+  def index
+    render json: @trends, each_serializer: REST::Admin::TagSerializer
+  end
+
+  private
+
+  def set_trends
+    @trends = TrendingTags.get(10, filtered: false)
+  end
+end