import { abbottOrders } from "./mappings/abbottTruckList.js"; import { standardOrders } from "./mappings/standardOrders.js"; export const ordersIn = async (data: any, user: any) => { /** * Bulk orders in, and custom file parsing. */ let success = true; let message = ""; let orderData: any = []; // what type of order are we dealing with? if (data["fileType"] === "standard") { // run the standard orders in const standard = await standardOrders(data["postOrders"], user); success = standard.success ?? false; message = standard.message ?? "Error posting Standard Orders"; orderData = standard.data; } if (data["fileType"] === "abbott") { // orders in const abbott = await abbottOrders(data["postOrders"], user); success = abbott.success ?? false; message = abbott.message ?? "Error posting Abbott Orders"; orderData = abbott.data; } if (data["fileType"] === "energizer") { // orders in } if (data["fileType"] === "loreal") { // orders in } if (data["fileType"] === "pg") { // orders in } return { success, message, data: orderData, }; };