chore: move call associations into Enterprise concerns
This commit is contained in:
@@ -108,7 +108,6 @@ class Conversation < ApplicationRecord
|
||||
|
||||
has_many :mentions, dependent: :destroy_async
|
||||
has_many :messages, dependent: :destroy_async, autosave: true
|
||||
has_many :calls, dependent: :destroy_async
|
||||
has_one :csat_survey_response, dependent: :destroy_async
|
||||
has_many :conversation_participants, dependent: :destroy_async
|
||||
has_many :notifications, as: :primary_actor, dependent: :destroy_async
|
||||
|
||||
@@ -450,3 +450,4 @@ class Message < ApplicationRecord
|
||||
end
|
||||
|
||||
Message.prepend_mod_with('Message')
|
||||
Message.include_mod_with('Concerns::Message')
|
||||
|
||||
@@ -5,6 +5,7 @@ module Enterprise::Concerns::Conversation
|
||||
belongs_to :sla_policy, optional: true
|
||||
has_one :applied_sla, dependent: :destroy_async
|
||||
has_many :sla_events, dependent: :destroy_async
|
||||
has_many :calls, dependent: :destroy_async
|
||||
has_many :captain_responses, class_name: 'Captain::AssistantResponse', dependent: :nullify, as: :documentable
|
||||
before_validation :validate_sla_policy, if: -> { sla_policy_id_changed? }
|
||||
around_save :ensure_applied_sla_is_created, if: -> { sla_policy_id_changed? }
|
||||
|
||||
@@ -7,5 +7,6 @@ module Enterprise::Concerns::Inbox
|
||||
through: :captain_inbox,
|
||||
class_name: 'Captain::Assistant'
|
||||
has_many :inbox_capacity_limits, dependent: :destroy
|
||||
has_many :calls, dependent: :destroy_async
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
module Enterprise::Concerns::Message
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_one :call, dependent: :nullify
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user