iachat/spec/controllers/api/v1/accounts
Tanmay Deep Sharma 341487b93e
feat: Add assignment policies controllers with jbuilder views (#12199)
## Linear reference:
https://linear.app/chatwoot/issue/CW-4649/re-imagine-assignments

## Description
This PR introduces the foundation for Assignment V2 system by
implementing assignment policies and their association with inboxes.
Assignment policies allow configuring how conversations are distributed
among agents, with support for different assignment orders (round_robin
in community, balanced in enterprise) and conversation prioritization
strategies

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality not to work as expected)
- [ ] This change requires a documentation update

## 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

Manual Testing:
1. Create assignment policy: POST
/api/v1/accounts/{id}/assignment_policies
2. List policies: GET /api/v1/accounts/{id}/assignment_policies
3. Assign policy to inbox: POST
/api/v1/accounts/{id}/assignment_policies/{id}/inboxes
4. View inbox policy: GET
/api/v1/accounts/{id}/inboxes/{id}/assignment_policy
5. Verify community edition ignores "balanced" assignment order
6. Verify enterprise edition supports both "round_robin" and "balanced"

- testing the flows after enterprise folder deletion

## 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 <pranavrajs@gmail.com>
Co-authored-by: Pranav <pranav@chatwoot.com>
2025-08-18 19:15:21 -07:00
..
actions chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
assignment_policies feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
channels chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
contacts feat: API to create HMAC verified conversations (#7209) 2023-05-29 21:57:24 +05:30
conversations feat: API Endpoints to update message status (#11387) 2025-04-29 15:33:11 -07:00
google refactor: use state-based authentication (#11690) 2025-06-18 17:39:06 +05:30
inboxes feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
instagram feat: Added the ability to create Instagram channel (#11182) 2025-04-03 13:57:14 +05:30
integrations feat: Add user attribution to Linear integration with actor authorization (#11774) 2025-07-01 16:49:26 +05:30
microsoft refactor: use state-based authentication (#11690) 2025-06-18 17:39:06 +05:30
notion feat: Whatsapp embedded signup (#11612) 2025-07-14 21:37:06 -07:00
twitter chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
whatsapp feat: add reauth flow for wa embedded signup (#11940) 2025-08-08 01:48:45 +05:30
agent_bots_controller_spec.rb feat: Ability to reset api_access_token (#11565) 2025-05-29 14:42:13 +05:30
agents_controller_spec.rb chore: Fix agent API returning 500 error (#9193) 2024-04-04 19:44:47 +05:30
articles_controller_spec.rb chore: Clean up report & knowledge base policies (#11234) 2025-04-03 16:00:32 -07:00
assignable_agents_controller_spec.rb chore: Add Assignable Agents API (#4722) 2022-05-23 19:24:07 +05:30
assignment_policies_controller_spec.rb feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
automation_rules_controller_spec.rb feat: validate query conditions (#10595) 2024-12-17 17:16:37 +05:30
bulk_actions_controller_spec.rb chore: Use find_each instead of .all.each (#6975) 2023-04-25 09:32:35 +05:30
callbacks_controller_spec.rb chore: Handle attachments in Whatsapp Channel (#3299) 2021-11-11 13:03:48 +05:30
campaigns_controller_spec.rb chore: Add validations to campaign model 2025-03-19 17:29:08 -07:00
canned_responses_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
categories_controller_spec.rb chore: Clean up report & knowledge base policies (#11234) 2025-04-03 16:00:32 -07:00
contact_inboxes_controller_spec.rb chore: Add an API to find the contacts using contact inbox sourceId (#8012) 2023-09-28 15:26:28 -07:00
contacts_controller_spec.rb feat: integrate LeadSquared CRM (#11284) 2025-04-29 09:14:00 +05:30
conversations_controller_spec.rb feat: Add conversation delete feature (#11677) 2025-06-05 15:53:17 -05:00
csat_survey_responses_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
custom_attribute_definitions_controller_spec.rb chore: Ability to filter conversations with priority (#10967) 2025-03-03 16:38:22 +05:30
custom_filters_controller_spec.rb fix: Revert the changes for SyncCustomFilterCountJob (#8238) 2023-10-27 10:45:48 -07:00
dashboard_apps_controller_spec.rb fix: validate url for Dashboard Apps [CW-2979] (#8736) 2024-01-18 17:48:30 +05:30
inbox_members_controller_spec.rb feat: invalidate cache after inbox members or team members update (#10869) 2025-02-20 21:28:38 -08:00
inboxes_controller_spec.rb feat: Add manual WhatsApp templates sync with UI (#12007) 2025-07-23 12:22:51 +04:00
labels_controller_spec.rb chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
macros_controller_spec.rb feat: Add upload under account scope (#7914) 2023-09-19 09:51:54 +05:30
notification_settings_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
notifications_controller_spec.rb feat: Update last_snoozed_at after the un-snooze notification (#8943) 2024-02-20 18:55:39 +05:30
portals_controller_spec.rb feat(cloud): Add support for viewing status of SSL in custom domains (#12011) 2025-07-30 10:52:47 -07:00
search_controller_spec.rb feat: allow searching articles in omnisearch (#11558) 2025-05-28 13:50:50 +05:30
team_members_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
teams_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
webhook_controller_spec.rb chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30