feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain

This commit is contained in:
2025-09-19 22:22:05 -05:00
parent caf2315191
commit e4477402ad
847 changed files with 165801 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { format } from "date-fns-tz";
import { createLog } from "../../logger/logger.js";
import { query } from "../../sqlServer/prodSqlServer.js";
import { fakeEDIUpdate } from "../../sqlServer/querys/dataMart/fakeEDIUpdate.js";
export const getFakeEDI = async (address: string) => {
let fakeEDI: any = [];
let updatedQuery = fakeEDIUpdate;
if (address) {
createLog(
"info",
"datamart",
"datamart",
"The user requested a specific address."
);
updatedQuery = fakeEDIUpdate.replace(
"--and IdAdresse = 14",
`and IdAdresse = ${address}`
);
}
try {
fakeEDI = await query(updatedQuery, "Gets fakeEDI orders to be fixed");
const correctedData = fakeEDI.data.map((n: any) => {
return {
...n,
DeliveryDate: format(n.DeliveryDate, "M/d/yyyy HH:mm"),
};
});
return {
success: true,
message: "Current open orders",
data: correctedData,
};
} catch (error) {
console.log(error);
return {
success: false,
message: "There was an error open orders",
data: error,
};
}
};