feat: move resolved contacts to a scope

This commit is contained in:
Shivam Mishra
2025-03-25 18:53:32 +05:30
parent 340e5d2acc
commit 400feb4388
+2 -4
View File
@@ -68,6 +68,8 @@ class Contact < ApplicationRecord
enum contact_type: { visitor: 0, lead: 1, customer: 2 }
scope :resolved_contacts, -> { where("contacts.email <> '' OR contacts.phone_number <> '' OR contacts.identifier <> ''") }
scope :order_on_last_activity_at, lambda { |direction|
order(
Arel::Nodes::SqlLiteral.new(
@@ -164,10 +166,6 @@ class Contact < ApplicationRecord
}
end
def self.resolved_contacts
where("contacts.email <> '' OR contacts.phone_number <> '' OR contacts.identifier <> ''")
end
def discard_invalid_attrs
phone_number_format
email_format