39 lines
926 B
TypeScript
39 lines
926 B
TypeScript
import { standardForecast } from "./mappings/standardForcast.js";
|
|
|
|
export const forecastIn = 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 forecast in
|
|
const standard = await standardForecast(data["postPostForecast"], user);
|
|
success = standard.success ?? false;
|
|
message = standard.message ?? "Error posting standard forecast";
|
|
orderData = standard.data;
|
|
}
|
|
|
|
if (data["fileType"] === "energizer") {
|
|
// orders in
|
|
}
|
|
|
|
if (data["fileType"] === "loreal") {
|
|
// orders in
|
|
}
|
|
|
|
if (data["fileType"] === "pg") {
|
|
// orders in
|
|
}
|
|
|
|
return {
|
|
success,
|
|
message,
|
|
data: orderData,
|
|
};
|
|
};
|