WIP Fortellis Certification changes.

This commit is contained in:
Patrick Fic
2025-12-31 09:05:25 -08:00
parent 37c16c2328
commit 5772e95a94

View File

@@ -290,7 +290,9 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
await MarkJobExported({ socket, jobid: JobData.id, JobData }); await MarkJobExported({ socket, jobid: JobData.id, JobData });
CreateFortellisLogEvent(socket, "DEBUG", `{5} Updating Service Vehicle History.`); try {
CreateFortellisLogEvent(socket, "DEBUG", `{7} Updating Service Vehicle History.`);
const DMSVehHistory = await InsertServiceVehicleHistory({ socket, redisHelpers, JobData }); const DMSVehHistory = await InsertServiceVehicleHistory({ socket, redisHelpers, JobData });
await setSessionTransactionData( await setSessionTransactionData(
socket.id, socket.id,
@@ -299,10 +301,17 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
DMSVehHistory, DMSVehHistory,
defaultFortellisTTL defaultFortellisTTL
); );
socket.emit("export-success", JobData.id); } catch (error) {
CreateFortellisLogEvent(socket, "ERROR", `{7.1} Error posting vehicle service history. ${error.message}`);
}
//TODO: IF THE VEHICLE SERVICE HISTORY FAILS, WE NEED TO MARK IT AS SUCH AND NOT DELETE THE TRANSACTION.
//socket.emit("export-success", JobData.id);
} else { } else {
//There was something wrong. Throw an error to trigger clean up. //There was something wrong. Throw an error to trigger clean up.
throw new Error("Error posting DMS Batch Transaction"); //throw new Error("Error posting DMS Batch Transaction");
} }
@@ -1281,7 +1290,7 @@ async function DeleteDmsWip({ socket, redisHelpers, JobData }) {
} }
async function MarkJobExported({ socket, jobid, JobData }) { async function MarkJobExported({ socket, jobid, JobData }) {
CreateFortellisLogEvent(socket, "ERROR", `Marking job as exported for id ${jobid}`); CreateFortellisLogEvent(socket, "DEBUG", `Marking job as exported for id ${jobid}`);
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
const currentToken = const currentToken =