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:
@@ -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");
|
||||
|
||||
@@ -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."
|
||||
// );
|
||||
// };
|
||||
|
||||
Reference in New Issue
Block a user