mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-12 02:18:18 +00:00
feat: add call lookup endpoint with lead matching + AI enrichment, token passthrough on platform service
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Controller, Post, Body, Logger, HttpException } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import axios from 'axios';
|
||||
import { OzonetelAgentService } from '../ozonetel/ozonetel-agent.service';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
@@ -9,7 +10,10 @@ export class AuthController {
|
||||
private readonly workspaceSubdomain: string;
|
||||
private readonly origin: string;
|
||||
|
||||
constructor(private config: ConfigService) {
|
||||
constructor(
|
||||
private config: ConfigService,
|
||||
private ozonetelAgent: OzonetelAgentService,
|
||||
) {
|
||||
this.graphqlUrl = config.get<string>('platform.graphqlUrl')!;
|
||||
this.workspaceSubdomain = process.env.PLATFORM_WORKSPACE_SUBDOMAIN ?? 'fortytwo-dev';
|
||||
this.origin = process.env.PLATFORM_ORIGIN ?? 'http://fortytwo-dev.localhost:4010';
|
||||
@@ -78,6 +82,20 @@ export class AuthController {
|
||||
|
||||
const tokens = tokenRes.data.data.getAuthTokensFromLoginToken.tokens;
|
||||
|
||||
// Auto-login Ozonetel agent (fire and forget — don't block auth)
|
||||
const ozAgentId = process.env.OZONETEL_AGENT_ID ?? 'agent3';
|
||||
const ozAgentPassword = process.env.OZONETEL_AGENT_PASSWORD ?? 'Test123$';
|
||||
const ozSipId = process.env.OZONETEL_SIP_ID ?? '521814';
|
||||
|
||||
this.ozonetelAgent.loginAgent({
|
||||
agentId: ozAgentId,
|
||||
password: ozAgentPassword,
|
||||
phoneNumber: ozSipId,
|
||||
mode: 'blended',
|
||||
}).catch(err => {
|
||||
this.logger.warn(`Ozonetel agent login failed (non-blocking): ${err.message}`);
|
||||
});
|
||||
|
||||
return {
|
||||
accessToken: tokens.accessOrWorkspaceAgnosticToken.token,
|
||||
refreshToken: tokens.refreshToken.token,
|
||||
|
||||
Reference in New Issue
Block a user