feat: sync Tiny orders directly to Graphs
All checks were successful
Build and Deploy / build-and-push (push) Successful in 59s

This commit is contained in:
Cauê Faleiros
2026-06-22 15:49:22 -03:00
parent 9a9e9bedf2
commit 3234ab6160
6 changed files with 611 additions and 1 deletions

View File

@@ -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.');