Fix main import script issue

This commit is contained in:
2025-02-16 11:54:28 -05:00
parent 9b8577f258
commit 702b956ff1
2 changed files with 13 additions and 13 deletions

View File

@@ -10,10 +10,10 @@ const importPurchaseOrders = require('./import/purchase-orders');
dotenv.config({ path: path.join(__dirname, "../.env") });
// Constants to control which imports run
const IMPORT_CATEGORIES = true;
const IMPORT_PRODUCTS = true;
const IMPORT_CATEGORIES = false;
const IMPORT_PRODUCTS = false;
const IMPORT_ORDERS = true;
const IMPORT_PURCHASE_ORDERS = true;
const IMPORT_PURCHASE_ORDERS = false;
// Add flag for incremental updates
const INCREMENTAL_UPDATE = process.env.INCREMENTAL_UPDATE !== 'false'; // Default to true unless explicitly set to false
@@ -202,14 +202,14 @@ async function main() {
records_updated = $3,
status = 'completed',
additional_info = jsonb_build_object(
'categories_enabled', $4,
'products_enabled', $5,
'orders_enabled', $6,
'purchase_orders_enabled', $7,
'categories_result', $8::jsonb,
'products_result', $9::jsonb,
'orders_result', $10::jsonb,
'purchase_orders_result', $11::jsonb
'categories_enabled', $4::boolean,
'products_enabled', $5::boolean,
'orders_enabled', $6::boolean,
'purchase_orders_enabled', $7::boolean,
'categories_result', COALESCE($8::jsonb, 'null'::jsonb),
'products_result', COALESCE($9::jsonb, 'null'::jsonb),
'orders_result', COALESCE($10::jsonb, 'null'::jsonb),
'purchase_orders_result', COALESCE($11::jsonb, 'null'::jsonb)
)
WHERE id = $12
`, [