feat: sync Tiny orders directly to Graphs
All checks were successful
Build and Deploy / build-and-push (push) Successful in 59s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 59s
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Request, Response } from 'express';
|
||||
import { sendToN8n } from '../services/n8n.service';
|
||||
import { sendTinyOrderToGraphs } from '../services/graphs.service';
|
||||
import axios from 'axios';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
@@ -131,6 +132,11 @@ export const handleTinyOrderUpdate = async (req: Request, res: Response): Promis
|
||||
dispatchPromises.push(sendToN8n(finalPayload, graphsUrl));
|
||||
}
|
||||
|
||||
if (fullOrderDetails && (process.env.GRAPHS_API_URL || process.env.NEXSTAR_GRAPHS_API_URL)) {
|
||||
console.log('-> Preparing direct dispatch to Graphs API...');
|
||||
dispatchPromises.push(sendTinyOrderToGraphs(fullOrderDetails));
|
||||
}
|
||||
|
||||
// Fire them all in parallel so one does not block the other
|
||||
await Promise.allSettled(dispatchPromises);
|
||||
console.log('All n8n dispatch attempts completed.');
|
||||
|
||||
Reference in New Issue
Block a user