mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
Replaces the untrusted platform function path (SDK's lead-auto-assign
was written but never deployed to either workspace — all leads created
after seeding are orphan).
Polls every 60s:
1. Fetch up to 100 unassigned leads (assignedAgent empty or null)
2. Fetch platform Agents whose live SupervisorService state is
ready/calling/in-call/acw (skip offline/break/training/unknown)
3. Build open-lead count per agent (single paginated query)
4. Assign each unassigned lead to the least-loaded active agent —
writes agent.name into lead.assignedAgent to match the worklist
filter (assignedAgent: { eq: agentName })
Catches every lead-creation path: CSV import, enquiry form,
missed-call webhook, widget, livekit. No platform changes needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
2.3 KiB
TypeScript
60 lines
2.3 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import configuration from './config/configuration';
|
|
import { AiModule } from './ai/ai.module';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { PlatformModule } from './platform/platform.module';
|
|
import { ExotelModule } from './exotel/exotel.module';
|
|
import { CallEventsModule } from './call-events/call-events.module';
|
|
import { OzonetelAgentModule } from './ozonetel/ozonetel-agent.module';
|
|
import { GraphqlProxyModule } from './graphql-proxy/graphql-proxy.module';
|
|
import { HealthModule } from './health/health.module';
|
|
import { WorklistModule } from './worklist/worklist.module';
|
|
import { CallAssistModule } from './call-assist/call-assist.module';
|
|
import { SearchModule } from './search/search.module';
|
|
import { SupervisorModule } from './supervisor/supervisor.module';
|
|
import { MaintModule } from './maint/maint.module';
|
|
import { RecordingsModule } from './recordings/recordings.module';
|
|
import { EventsModule } from './events/events.module';
|
|
import { CallerResolutionModule } from './caller/caller-resolution.module';
|
|
import { RulesEngineModule } from './rules-engine/rules-engine.module';
|
|
import { ConfigThemeModule } from './config/config-theme.module';
|
|
import { WidgetModule } from './widget/widget.module';
|
|
import { TeamModule } from './team/team.module';
|
|
import { MasterdataModule } from './masterdata/masterdata.module';
|
|
import { LeadsModule } from './leads/leads.module';
|
|
import { TelephonyRegistrationService } from './telephony-registration.service';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
load: [configuration],
|
|
isGlobal: true,
|
|
}),
|
|
AiModule,
|
|
AuthModule,
|
|
PlatformModule,
|
|
ExotelModule,
|
|
CallEventsModule,
|
|
OzonetelAgentModule,
|
|
GraphqlProxyModule,
|
|
HealthModule,
|
|
WorklistModule,
|
|
CallAssistModule,
|
|
SearchModule,
|
|
SupervisorModule,
|
|
MaintModule,
|
|
RecordingsModule,
|
|
EventsModule,
|
|
CallerResolutionModule,
|
|
RulesEngineModule,
|
|
ConfigThemeModule,
|
|
WidgetModule,
|
|
TeamModule,
|
|
MasterdataModule,
|
|
LeadsModule,
|
|
],
|
|
providers: [TelephonyRegistrationService],
|
|
})
|
|
export class AppModule {}
|