feat(dm): standard forecast added in rest of migration to come

This commit is contained in:
2026-06-14 03:52:34 -05:00
parent d85f08cb19
commit 39db142db4
18 changed files with 6163 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import https from "node:https";
import axios from "axios";
import { createLogger } from "../logger/logger.controller.js";
import { returnFunc } from "./returnHelper.utils.js";
import { tryCatch } from "./trycatch.utils.js";
@@ -59,9 +60,14 @@ export const prodEndpointCreation = async (endpoint: string) => {
* @param timeoutDelay
* @returns
*/
export const runProdApi = async (data: Data) => {
export const runProdApi = async (data: Data, name?: string) => {
const log = createLogger({ module: "utils", subModule: "prodEndpoints" });
const url = await prodEndpointCreation(data.endpoint);
log.debug(
{ stack: data },
`Info passed over for ${name ? name : "Missing name"}`,
);
const { data: d, error } = await tryCatch(
axios({
method: data.method as string,
@@ -94,7 +100,7 @@ export const runProdApi = async (data: Data) => {
level: "error",
module: "utils",
subModule: "prodEndpoint",
message: "Data from prod endpoint",
message: "Error data from prod endpoint",
data: d.data,
notify: false,
});
@@ -104,10 +110,30 @@ export const runProdApi = async (data: Data) => {
level: "error",
module: "utils",
subModule: "prodEndpoint",
message: "Data from prod endpoint",
message: "Error data from prod endpoint",
data: d.data,
notify: false,
});
case 500:
return returnFunc({
success: false,
level: "error",
module: "utils",
subModule: "prodEndpoint",
message: "Error data from prod endpoint",
data: d.data,
notify: false,
});
default:
returnFunc({
success: false,
level: "error",
module: "utils",
subModule: "prodEndpoint",
message: "Unknown error encountered",
data: d?.data as any,
notify: false,
});
}
if (error) {