|
|
|
|
@ -213,9 +213,12 @@ const setupMessageHandler = async () => {
|
|
|
|
|
const now = new Date(new Date().getTime() + 60 * 60 * 1000).toISOString();
|
|
|
|
|
|
|
|
|
|
const savedId = uniqueMsgId(messageData);
|
|
|
|
|
// const targetUpsert = messageData.externalId ? { actionId: messageData.externalId } : { id: savedId };
|
|
|
|
|
const targetUpsert = [{ actionId: messageData.externalId }, { id: savedId }];
|
|
|
|
|
const savedMsg = await getOutboundMessageByIdOrExternalId(targetUpsert);
|
|
|
|
|
let targetUpsert = messageData?.externalId ? { actionId: messageData.externalId } : { id: savedId };
|
|
|
|
|
const targetUpsert0 = [{ actionId: messageData?.externalId || savedId }, { id: savedId }];
|
|
|
|
|
const savedMsg = await getOutboundMessageByIdOrExternalId(targetUpsert0);
|
|
|
|
|
if (savedMsg?.sn) {
|
|
|
|
|
targetUpsert = { sn: savedMsg.sn };
|
|
|
|
|
}
|
|
|
|
|
const bixFields = pick(savedMsg, ['actionId', 'externalId']);
|
|
|
|
|
const savedTimeFields = pick(savedMsg, Object.values(timeField));
|
|
|
|
|
logger.info('message evt\n', eventName, messageData, savedMsg);
|
|
|
|
|
|