refactor(standard in): returns the orders in success or failed and why

This commit is contained in:
2025-04-17 23:11:32 -05:00
parent 3df1ceaaac
commit 085dc64db9

View File

@@ -96,6 +96,7 @@ export const standardOrders = async (data: any, user: any) => {
return acc; return acc;
}, {}); }, {});
let postedOrders: any = [];
for (const [customerID, orders] of Object.entries(groupedByCustomer)) { for (const [customerID, orders] of Object.entries(groupedByCustomer)) {
// console.log(`Running for Customer ID: ${customerID}`); // console.log(`Running for Customer ID: ${customerID}`);
const newOrders: any = orders; const newOrders: any = orders;
@@ -138,13 +139,19 @@ export const standardOrders = async (data: any, user: any) => {
//console.log(updatedPredefinedObject); //console.log(updatedPredefinedObject);
// post the orders to the server // post the orders to the server
const posting = await postOrders(updatedPredefinedObject, user); const posting: any = await postOrders(updatedPredefinedObject, user);
postedOrders.push({
customer: customerID,
success: posting.success,
message: posting.message,
});
} }
return { return {
success: true, success: true,
message: message:
"Standard Template was just processed successfully, please check AlplaProd 2.0 to confirm no errors. ", "Standard Template was just processed successfully, please check AlplaProd 2.0 to confirm no errors. ",
data: [], data: postedOrders,
}; };
}; };