feat(missing inv): adding a way to check for missing data in case it dose pull on the correct days

This commit is contained in:
2025-11-03 18:01:58 -06:00
parent 8fca201e04
commit d17edb1f9c
7 changed files with 232 additions and 245 deletions

View File

@@ -8,7 +8,6 @@ import { serverSettings } from "../../server/controller/settings/getSettings.js"
import { query } from "../../sqlServer/prodSqlServer.js";
import { activeArticle } from "../../sqlServer/querys/dataMart/article.js";
import { totalInvNoRn } from "../../sqlServer/querys/dataMart/totalINV.js";
import { deleteHistory } from "./removeHistorical.js";
export const historicalInvIMmport = async () => {
const plantToken = serverSettings.filter((n) => n.name === "plantToken");

View File

@@ -20,32 +20,32 @@ import { createLog } from "../../logger/logger.js";
// }
// };
export const deleteHistory = async () => {
const { data, error } = await tryCatch(
db
.delete(invHistoricalData)
.where(
lte(
invHistoricalData.histDate,
sql`(NOW() - INTERVAL '365 day')::date`
)
)
);
// export const deleteHistory = async () => {
// const { data, error } = await tryCatch(
// db
// .delete(invHistoricalData)
// .where(
// lte(
// invHistoricalData.histDate,
// sql`(NOW() - INTERVAL '365 day')::date`
// )
// )
// );
if (error) {
createLog(
"error",
"eom",
"eom",
"There was an error deleting the historical data."
);
return;
}
// if (error) {
// createLog(
// "error",
// "eom",
// "eom",
// "There was an error deleting the historical data."
// );
// return;
// }
createLog(
"info",
"eom",
"eom",
"Data older than 45 days has been deleted."
);
};
// createLog(
// "info",
// "eom",
// "eom",
// "Data older than 45 days has been deleted."
// );
// };