fix: harden PrestaShop automation jobs

This commit is contained in:
fatequod
2026-08-03 11:20:09 +02:00
parent 5a1e6ffbdd
commit faf1c3ea06
12 changed files with 812 additions and 245 deletions
+5
View File
@@ -8,6 +8,10 @@ const schema = new DB.Schema('ps_orders', {
reference: { type: 'string', optional: true, default: '' },
syncedAt: { type: 'date', optional: true, default: () => new Date() },
paymentSyncedAt: { type: 'date', optional: true },
// Ostatnia kumulatywna kwota total_paid_real potwierdzona w core/orders.
paymentTotalSynced: { type: 'number', optional: true },
paymentCheckedAt: { type: 'date', optional: true },
nextPaymentCheckAt: { type: 'date', optional: true },
});
schema.pre('validate', function (data) {});
@@ -16,5 +20,6 @@ schema.post('create', function (data) {});
DB.createIndex('ps_orders', { psOrderId: 1, shopConfigId: 1 }, { unique: true });
DB.createIndex('ps_orders', { orbitoOrderId: 1 });
DB.createIndex('ps_orders', { syncedAt: -1 });
DB.createIndex('ps_orders', { shopConfigId: 1, nextPaymentCheckAt: 1, syncedAt: 1 });
module.exports = schema;