summaryrefslogtreecommitdiff
path: root/app/helpers/admin/abuse_reports_helper.rb
blob: 275bed406f17ce4511a055b6dcbf0ce64005935a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Admin
  module AbuseReportsHelper
    def abuse_reports_list_data(reports)
      {
        abuse_reports_data: {
          categories: AbuseReport.categories.keys,
          reports: Admin::AbuseReportSerializer.new.represent(reports),
          pagination: {
            current_page: reports.current_page,
            per_page: reports.limit_value,
            total_items: reports.total_count
          }
        }.to_json
      }
    end

    def abuse_report_data(report)
      {
        abuse_report_data: Admin::AbuseReportDetailsSerializer.new.represent(report).to_json
      }
    end
  end
end