report_serializer.rb 705 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class REST::Admin::ReportSerializer < ActiveModel::Serializer
  3. attributes :id, :action_taken, :action_taken_at, :category, :comment,
  4. :forwarded, :created_at, :updated_at
  5. has_one :account, serializer: REST::Admin::AccountSerializer
  6. has_one :target_account, serializer: REST::Admin::AccountSerializer
  7. has_one :assigned_account, serializer: REST::Admin::AccountSerializer
  8. has_one :action_taken_by_account, serializer: REST::Admin::AccountSerializer
  9. has_many :statuses, serializer: REST::StatusSerializer
  10. has_many :rules, serializer: REST::RuleSerializer
  11. def id
  12. object.id.to_s
  13. end
  14. def statuses
  15. object.statuses.with_includes
  16. end
  17. end