feat: Add agent capacity controllers (#12200)
## Linear reference: https://linear.app/chatwoot/issue/CW-4649/re-imagine-assignments ## Description This PR introduces the foundation for Assignment V2 system by implementing agent_capacity and their association with inboxes and users. ## Type of change - [ ] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? Test Coverage: - Controller specs for assignment policies CRUD operations - Enterprise-specific specs for balanced assignment order - Model specs for community/enterprise separation ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
committed by
GitHub
parent
39dfa35229
commit
ad90deb709
21
spec/factories/agent_capacity_policies.rb
Normal file
21
spec/factories/agent_capacity_policies.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
FactoryBot.define do
|
||||
factory :agent_capacity_policy do
|
||||
account
|
||||
sequence(:name) { |n| "Agent Capacity Policy #{n}" }
|
||||
description { 'Test agent capacity policy' }
|
||||
exclusion_rules { {} }
|
||||
|
||||
trait :with_overall_capacity do
|
||||
exclusion_rules { { 'overall_capacity' => 10 } }
|
||||
end
|
||||
|
||||
trait :with_time_exclusions do
|
||||
exclusion_rules do
|
||||
{
|
||||
'hours' => [0, 1, 2, 3, 4, 5],
|
||||
'days' => %w[saturday sunday]
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
7
spec/factories/inbox_capacity_limits.rb
Normal file
7
spec/factories/inbox_capacity_limits.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
FactoryBot.define do
|
||||
factory :inbox_capacity_limit do
|
||||
association :agent_capacity_policy, factory: :agent_capacity_policy
|
||||
inbox
|
||||
conversation_limit { 5 }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user