about summary refs log tree commit diff
path: root/app/serializers/rest/report_serializer.rb
blob: f4e9af2494a77b743f3b4bed69bcd92ed86c1c7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class REST::ReportSerializer < ActiveModel::Serializer
  attributes :id, :action_taken, :action_taken_at, :category, :comment,
             :forwarded, :created_at, :status_ids, :rule_ids

  has_one :target_account, serializer: REST::AccountSerializer

  def id
    object.id.to_s
  end

  def status_ids
    object&.status_ids&.map(&:to_s)
  end

  def rule_ids
    object&.rule_ids&.map(&:to_s)
  end
end