about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/rest/filter_result_serializer.rb5
-rw-r--r--app/serializers/rest/filter_serializer.rb1
-rw-r--r--app/serializers/rest/filter_status_serializer.rb13
3 files changed, 19 insertions, 0 deletions
diff --git a/app/serializers/rest/filter_result_serializer.rb b/app/serializers/rest/filter_result_serializer.rb
index 0ef4db79a..54ead2f1f 100644
--- a/app/serializers/rest/filter_result_serializer.rb
+++ b/app/serializers/rest/filter_result_serializer.rb
@@ -3,4 +3,9 @@
 class REST::FilterResultSerializer < ActiveModel::Serializer
   belongs_to :filter, serializer: REST::FilterSerializer
   has_many :keyword_matches
+  has_many :status_matches
+
+  def status_matches
+    object.status_matches&.map(&:to_s)
+  end
 end
diff --git a/app/serializers/rest/filter_serializer.rb b/app/serializers/rest/filter_serializer.rb
index 98d7edb17..8816dd807 100644
--- a/app/serializers/rest/filter_serializer.rb
+++ b/app/serializers/rest/filter_serializer.rb
@@ -3,6 +3,7 @@
 class REST::FilterSerializer < ActiveModel::Serializer
   attributes :id, :title, :context, :expires_at, :filter_action
   has_many :keywords, serializer: REST::FilterKeywordSerializer, if: :rules_requested?
+  has_many :statuses, serializer: REST::FilterStatusSerializer, if: :rules_requested?
 
   def id
     object.id.to_s
diff --git a/app/serializers/rest/filter_status_serializer.rb b/app/serializers/rest/filter_status_serializer.rb
new file mode 100644
index 000000000..6bcbaa249
--- /dev/null
+++ b/app/serializers/rest/filter_status_serializer.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class REST::FilterStatusSerializer < ActiveModel::Serializer
+  attributes :id, :status_id
+
+  def id
+    object.id.to_s
+  end
+
+  def status_id
+    object.status_id.to_s
+  end
+end