Skip to content

Commit

Permalink
Merge pull request #38 from ringcentral/logIdNullHandling
Browse files Browse the repository at this point in the history
Handle Case when CallLog Creation failed and logId is null
  • Loading branch information
DaKingKong authored Jul 5, 2024
2 parents e434189 + 1dc7814 commit 71e3e85
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/core/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ async function createCallLog({ platform, userId, incomingData }) {
name: incomingData.contactName ?? ""
};
const { logId, returnMessage } = await platformModule.createCallLog({ user, contactInfo, authHeader, callLog, note, additionalSubmission });
await CallLogModel.create({
id: incomingData.logInfo.id,
sessionId: incomingData.logInfo.sessionId,
platform,
thirdPartyLogId: logId,
userId
});
if (!!logId) {
await CallLogModel.create({
id: incomingData.logInfo.id,
sessionId: incomingData.logInfo.sessionId,
platform,
thirdPartyLogId: logId,
userId
});
}
return { successful: true, logId, returnMessage };
} catch (e) {
console.log(`Error: status: ${e.response?.status}. data: ${e.response?.data}`);
Expand Down

0 comments on commit 71e3e85

Please sign in to comment.