Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import {
facebookRepairIntegrations,
facebookCreateIntegrations,
} from '@/integrations/facebook/messageBroker';
import {
callCreateIntegration,
callRemoveIntergration,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in import: 'callRemoveIntergration' seems misspelled. Consider renaming to 'callRemoveIntegration' for consistency.

Suggested change
callRemoveIntergration,
callRemoveIntegration,

callUpdateIntegration,
} from '~/modules/integrations/call/messageBroker';
Comment on lines +22 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the typo in the imported function name.

There's a typo in callRemoveIntergration - it should be callRemoveIntegration. This typo needs to be fixed in both the import statement and the source function in the messageBroker file.

 import {
   callCreateIntegration,
-  callRemoveIntergration,
+  callRemoveIntegration,
   callUpdateIntegration,
 } from '~/modules/integrations/call/messageBroker';

Also ensure the function name is corrected in backend/plugins/frontline_api/src/modules/integrations/call/messageBroker.ts.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
callCreateIntegration,
callRemoveIntergration,
callUpdateIntegration,
} from '~/modules/integrations/call/messageBroker';
import {
callCreateIntegration,
callRemoveIntegration,
callUpdateIntegration,
} from '~/modules/integrations/call/messageBroker';
🤖 Prompt for AI Agents
In
backend/plugins/frontline_api/src/modules/inbox/graphql/resolvers/mutations/integrations.ts
lines 22 to 26, fix the typo in the import statement by changing
callRemoveIntergration to callRemoveIntegration. Then, in
backend/plugins/frontline_api/src/modules/integrations/call/messageBroker.ts,
rename the function callRemoveIntergration to callRemoveIntegration to match the
corrected import.


interface IntegrationParams {
integrationId: string;
Expand Down Expand Up @@ -52,6 +57,8 @@ export const sendCreateIntegration = async (
switch (serviceName) {
case 'facebook':
return await facebookCreateIntegrations({ subdomain, data });
case 'call':
return await callCreateIntegration({ subdomain, data });

case 'instagram':
// TODO: Implement Instagram integration
Expand Down Expand Up @@ -80,6 +87,8 @@ export const sendUpdateIntegration = async (
switch (serviceName) {
case 'facebook':
return await facebookUpdateIntegrations({ subdomain, data });
case 'call':
return await callUpdateIntegration({ subdomain, data });
Comment on lines +90 to +91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the return value handling in callUpdateIntegration.

The implementation is consistent with the existing pattern. However, based on the messageBroker implementation, callUpdateIntegration doesn't explicitly return a value (unlike callCreateIntegration), which could cause this function to return undefined for successful operations.


🏁 Script executed:

#!/bin/bash
# Check the return behavior of callUpdateIntegration function
ast-grep --pattern 'export async function callUpdateIntegration($_) {
  $$$
}'

Length of output: 1130


Ensure callUpdateIntegration returns a value on success

The callUpdateIntegration implementation in
backend/plugins/frontline_api/src/modules/integrations/call/messageBroker.ts
currently swallows the success path and only returns on error. That causes callers (e.g. your resolver) to receive undefined when the update succeeds.

Please update the function to return the result of updateIntegration (or an explicit success payload). For example:

 export async function callUpdateIntegration({ subdomain, data }) {
   try {
-    updateIntegration({ subdomain, data });
+    return await updateIntegration({ subdomain, data });
   } catch (e) {
     return {
       status: 'error',
       errorMessage: `Failed to update integration: ${e.message}`,
     };
   }
 }

This ensures callers always get a well-defined response.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case 'call':
return await callUpdateIntegration({ subdomain, data });
export async function callUpdateIntegration({ subdomain, data }) {
try {
return await updateIntegration({ subdomain, data });
} catch (e) {
return {
status: 'error',
errorMessage: `Failed to update integration: ${e.message}`,
};
}
}
🤖 Prompt for AI Agents
In backend/plugins/frontline_api/src/modules/integrations/call/messageBroker.ts,
update the callUpdateIntegration function to return the result of
updateIntegration or an explicit success payload on success instead of returning
nothing. This ensures that callers like the resolver in integrations.ts receive
a defined value rather than undefined when the update succeeds.


case 'instagram':
break;
Expand All @@ -106,6 +115,8 @@ export const sendRemoveIntegration = async (
switch (serviceName) {
case 'facebook':
return await facebookRemoveIntegrations({ subdomain, data });
case 'call':
return await callRemoveIntergration({ subdomain, data });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in sendRemoveIntegration: 'callRemoveIntergration' is used. Consider renaming to 'callRemoveIntegration' for consistency.


case 'instagram':
break;
Expand Down