feat(fakeedi): fake edi macro update implemented
This commit is contained in:
39
server/services/dataMart/controller/fakeEDIUpdate.ts
Normal file
39
server/services/dataMart/controller/fakeEDIUpdate.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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");
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: "Current open orders",
|
||||
data: fakeEDI.data,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return {
|
||||
success: false,
|
||||
message: "There was an error open orders",
|
||||
data: error,
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user