feat(silo): added in charts and historical data

This commit is contained in:
2025-04-09 17:48:03 -05:00
parent efc630f5f8
commit bad390ec17
14 changed files with 495 additions and 92 deletions

View File

@@ -56,17 +56,17 @@ export const migrateAdjustments = async () => {
/**
* Migrate all the silo adjustments :D
*/
const silo: any = s?.data;
const silo: any = s?.data.data;
createLog("info", "silo", "logistics", "Starting migration.");
for (let i = 0; i < silo.length; i++) {
const migrate = await db.insert(siloAdjustments).values({
warehouseID: silo[0].warehouseID,
locationID: silo[0].locationID,
currentStockLevel: silo[0].currentStockLevel,
newLevel: silo[0].newLevel,
dateAdjusted: new Date(silo[0].dateAdjusted),
lastDateAdjusted: new Date(silo[0].lastDateAdjusted),
add_user: silo[0].add_user,
warehouseID: silo[i].warehouseID,
locationID: silo[i].locationID,
currentStockLevel: silo[i].currentStockLevel,
newLevel: silo[i].newLevel,
dateAdjusted: new Date(silo[i].dateAdjusted),
lastDateAdjusted: new Date(silo[i].lastDateAdjusted),
add_user: silo[i].add_user,
});
createLog(
"info",
@@ -87,5 +87,3 @@ export const migrateAdjustments = async () => {
.where(eq(settings.name, "siloAdjMigrations"));
createLog("info", "silo", "logistics", "Migration completed.");
};
migrateAdjustments();