mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-10 17:16:05 +00:00
## 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>
28 lines
819 B
Ruby
28 lines
819 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: agent_capacity_policies
|
|
#
|
|
# id :bigint not null, primary key
|
|
# description :text
|
|
# exclusion_rules :jsonb not null
|
|
# name :string(255) not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# account_id :bigint not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_agent_capacity_policies_on_account_id (account_id)
|
|
#
|
|
class AgentCapacityPolicy < ApplicationRecord
|
|
MAX_NAME_LENGTH = 255
|
|
|
|
belongs_to :account
|
|
has_many :inbox_capacity_limits, dependent: :destroy
|
|
has_many :inboxes, through: :inbox_capacity_limits
|
|
has_many :account_users, dependent: :nullify
|
|
|
|
validates :name, presence: true, length: { maximum: MAX_NAME_LENGTH }
|
|
validates :account, presence: true
|
|
end
|