6:14:41 PM [express] GET /api/allegro/connection-status 304 in 146ms :: {"connected":true,"requiresR…
✅ Saved order 2ff20c60-b1be-11f0-8aa4-7535fac2a332 to PostgreSQL (UPDATED)
📸 enrichAllegroOrderWithImages() for order 2ff20c60-b1be-11f0-8aa4-7535fac2a332
📸 Found 0 Allegro products with images for order 2ff20c60-b1be-11f0-8aa4-7535fac2a332
📸 enrichAllegroOrderWithImages() completed
🔍 DEBUG - Allegro payment raw data for order 2ff20c60-b1be-11f0-8aa4-7535fac2a332:
   payment.paidAmount.amount = "undefined" → paidAmount = 0
   summary.totalToPay.amount = "352.00" → totalToPay = 352
   payment.finishedAt = "null" → hasFinishedAt = false
   Calculated paymentStatus = "UNPAID"
📅 Użyto order_date z allegro.orders: Sat Oct 25 2025 16:19:11 GMT+0000 (Coordinated Universal Time)
🔍 DEBUG - SELECT previousState result for ALLEGRO-2ff20c60-b1be-11f0-8aa4-7535fac2a332: [
  {
    "id": 14337,
    "status": "Wypełnione",
    "payment_status": "UNPAID",
    "payment_amount": null,
    "tracking_numbers": null,
    "refund_amount": "0",
    "has_returns": false,
    "buyer_address": null,
    "buyer_city": null
  }
]
🔍 DEBUG - Porównanie wartości dla #14337:
   payment_status: prev="UNPAID" new="UNPAID"
   payment_amount: prev="null" (object) new="undefined" (undefined)
   buyer_address: prev="null" new="null"
   ✅ compareNumeric zwrócił FALSE: null === undefined
🔄 Wykryto 1 zmian w zamówieniu #14337:
   📝 status: "Wypełnione" → "NEW"
🔍 DEBUG - UPDATE parameter (payment_amount) for ALLEGRO-2ff20c60-b1be-11f0-8aa4-7535fac2a332:
   payment.type = ONLINE
   payment.paidAmount = null
   payment.paidAmount?.amount = undefined
   orderData.sum = undefined
   totalToPayAmount = 352.00
   Final value = undefined
🔍 [ORDER NUMBERING DEBUG] ALLEGRO-2ff20c60-b1be-11f0-8aa4-7535fac2a332: isNew=false
⚠️  [PRE-INSERT] Pomijam nadawanie numeru - zamówienie już istnieje w commerce.orders z numerem
🔄 Aktualizuję istniejące zamówienie ALLEGRO-2ff20c60-b1be-11f0-8aa4-7535fac2a332
⏭️  Pominięto duplikat zmiany: #14337 - status
6:14:42 PM [express] GET /api/sync/status 304 in 141ms :: {"lastSyncAt":"2025-10-25T18:13:29.424Z","…
6:14:42 PM [express] GET /api/orders/statistics 304 in 145ms :: {"totalOrders":677,"paidOrders":614,…
🔍 DEBUG - RETURNING after INSERT/UPDATE for ALLEGRO-2ff20c60-b1be-11f0-8aa4-7535fac2a332:
   returned_payment_amount = null
❌ Error saving order 2ff20c60-b1be-11f0-8aa4-7535fac2a332 to commerce: error: column "catalog_product_id" of relation "order_items" does not exist
    at /home/runner/workspace/node_modules/pg/lib/client.js:545:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async saveOrderToCommerce (/home/runner/workspace/server/postgres.ts:1898:7)
    at async syncOrders (/home/runner/workspace/server/routes.ts:884:24) {
  length: 143,
  severity: 'ERROR',
  code: '42703',
  detail: undefined,
  hint: undefined,
  position: '190',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_target.c',
  line: '1066',
  routine: 'checkInsertTargets'
}
Failed to save order 2ff20c60-b1be-11f0-8aa4-7535fac2a332 to PostgreSQL: error: column "catalog_product_id" of relation "order_items" does not exist
    at /home/runner/workspace/node_modules/pg/lib/client.js:545:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async saveOrderToCommerce (/home/runner/workspace/server/postgres.ts:1898:7)
    at async syncOrders (/home/runner/workspace/server/routes.ts:884:24) {
  length: 143,
  severity: 'ERROR',
  code: '42703',
  detail: undefined,
  hint: undefined,
  position: '190',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_target.c',
  line: '1066',
  routine: 'checkInsertTargets'
}