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

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

  has_one :account, serializer: REST::Admin::AccountSerializer
  has_one :target_account, serializer: REST::Admin::AccountSerializer
  has_one :assigned_account, serializer: REST::Admin::AccountSerializer
  has_one :action_taken_by_account, serializer: REST::Admin::AccountSerializer

  has_many :statuses, serializer: REST::StatusSerializer
  has_many :rules, serializer: REST::RuleSerializer

  def id
    object.id.to_s
  end

  def statuses
    object.statuses.with_includes
  end
end