feat: sla-2 add automation backend support for SLA (#8775)

* feat: add automation support for SLA

* feat: add sla action in automtion UI

* chore: revert frontend changes

* chore: refactor to ee namespace

* chore: refactor automation rule to ee namespace

* feat: create applied_sla table entry

* chore: add applied_sla spec

* chore: rubocop fixes

---------

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Vishnu Narayanan
2024-02-01 15:42:12 +05:30
committed by GitHub
parent de98e434d6
commit b8047f0912
6 changed files with 68 additions and 6 deletions

View File

@@ -0,0 +1,9 @@
module Enterprise::AutomationRule
def conditions_attributes
super + %w[sla_policy_id]
end
def actions_attributes
super + %w[add_sla]
end
end

View File

@@ -0,0 +1,15 @@
module Enterprise::ActionService
def add_sla(sla_policy)
@conversation.update!(sla_policy_id: sla_policy.id)
create_applied_sla(sla_policy)
end
def create_applied_sla(sla_policy)
AppliedSla.create!(
account_id: @conversation.account_id,
sla_policy_id: sla_policy.id,
conversation_id: @conversation.id,
sla_status: 'active'
)
end
end