IO-3330 CARFAX Datapump

Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
Allan Carr
2025-08-14 09:17:02 -07:00
parent 7873405a30
commit 60258a0f5d

View File

@@ -143,7 +143,7 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
});
const carfaxObject = {
shopid: bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
shopid: bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
shop_name: bodyshop.shopname,
job: jobs.map((j) =>
CreateRepairOrderTag({ ...j, bodyshop: bodyshops_by_pk }, function ({ job, error }) {
@@ -161,9 +161,9 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
const jsonObj = {
bodyshopid: bodyshop.id,
imexshopid: bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
imexshopid: bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
json: JSON.stringify(carfaxObject, null, 2),
filename: `${bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase()}_${moment().format("DDMMYYYY_HHMMss")}.json`,
filename: `${bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase()}_${moment().format("DDMMYYYY_HHMMss")}.json`,
count: carfaxObject.job.length
};
@@ -175,7 +175,7 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
allXMLResults.push({
bodyshopid: bodyshop.id,
imexshopid: bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
imexshopid: bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
count: jsonObj.count,
filename: jsonObj.filename,
result: jsonObj.result
@@ -190,7 +190,7 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
allErrors.push({
bodyshopid: bodyshop.id,
imexshopid: bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
imexshopid: bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
CARFAXid: bodyshop.CARFAXid,
fatal: true,
errors: [error.toString()]
@@ -198,7 +198,7 @@ async function processShopData(shopsToProcess, start, end, skipUpload, ignoreDat
} finally {
allErrors.push({
bodyshopid: bodyshop.id,
imexshopid: bodyshop.imexshopid.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
imexshopid: bodyshop.imexshopid?.toLowerCase() || bodyshop.shopname.replace(/[^a-zA-Z0-9]/g, "").toLowerCase(),
CARFAXid: bodyshop.CARFAXid,
errors: erroredJobs.map((ej) => ({
ro_number: ej.job?.ro_number,