Skip to content

Commit c75d663

Browse files
add comment to document auto-assignment bussines rule
1 parent 06820bc commit c75d663

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/models/src/helpers/omnichannel/agentStatus.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { UserStatus } from '@rocket.chat/core-typings';
22
import type { IUser } from '@rocket.chat/core-typings';
33
import type { Filter } from 'mongodb';
44

5+
/**
6+
* Builds the query to find online and available agents for livechat auto-assignment.
7+
* * According to product rules, the primary conditions for auto-assignment are:
8+
* - User must have the 'livechat-agent' role.
9+
* - Livechat service status (`statusLivechat`) must be 'available'.
10+
* - User's global status must NOT be 'offline' (Bots are exempt from this rule).
11+
* - If the "Accept new omnichannel requests when the agent is idle" (aka `Livechat_enabled_when_agent_idle`) setting is OFF,
12+
* then the statusConnection must NOT be 'away'.
13+
*/
514
export const queryStatusAgentOnline = (extraFilters = {}, isLivechatEnabledWhenAgentIdle?: boolean): Filter<IUser> => ({
615
statusLivechat: 'available',
716
roles: 'livechat-agent',

0 commit comments

Comments
 (0)