refactor(datamart): if added to query will include plant token now

This commit is contained in:
2026-06-08 15:24:45 -05:00
parent 5f2148f5f0
commit 7d722c4aac

View File

@@ -79,6 +79,7 @@ const lstDbRun = async (data: Data) => {
return []; return [];
}; };
export const runDatamartQuery = async (data: Data) => { export const runDatamartQuery = async (data: Data) => {
console.log(data.options.includePlantToken);
// search the query db for the query by name // search the query db for the query by name
const considerLstDBRuns = ["psiInventory"]; const considerLstDBRuns = ["psiInventory"];
@@ -326,8 +327,13 @@ export const runDatamartQuery = async (data: Data) => {
level: "info", level: "info",
module: "datamart", module: "datamart",
subModule: "query", subModule: "query",
message: `Data for: ${data.name}`, message: `Data for: ${data.name} ${data.options.includePlantToken ? "including plant token" : ""}`,
data: queryRun.data, // if includePlantToken was passed we should map this into the data
data: data.options.includePlantToken
? queryRun.data.map((i) => {
return { plantToken: process.env.PROD_PLANT_TOKEN, ...i };
})
: queryRun.data,
notify: false, notify: false,
}); });
}; };