feat(128): erli orders import

Phase 128 complete:
- add Erli /inbox order import with safe mark-read ACK
- add cron/manual import controls and sync state tracking
- map Erli orders into orderPRO aggregates with mapper tests and docs
This commit is contained in:
2026-05-15 23:54:22 +02:00
parent 3ea8cdc941
commit 2565d9b754
23 changed files with 1989 additions and 35 deletions

View File

@@ -0,0 +1,29 @@
CREATE TABLE IF NOT EXISTS integration_order_sync_state (
integration_id INT UNSIGNED NOT NULL PRIMARY KEY,
last_synced_order_updated_at DATETIME NULL,
last_synced_source_order_id VARCHAR(64) NULL,
last_synced_external_order_id VARCHAR(128) NULL,
last_run_at DATETIME NULL,
last_success_at DATETIME NULL,
last_error VARCHAR(500) NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT erli_integration_order_sync_state_integration_fk
FOREIGN KEY (integration_id) REFERENCES integrations(id)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE integration_order_sync_state
ADD COLUMN IF NOT EXISTS last_synced_order_updated_at DATETIME NULL AFTER integration_id,
ADD COLUMN IF NOT EXISTS last_synced_source_order_id VARCHAR(64) NULL AFTER last_synced_order_updated_at,
ADD COLUMN IF NOT EXISTS last_success_at DATETIME NULL AFTER last_run_at;
INSERT INTO cron_schedules (
job_type, interval_seconds, priority, max_attempts, payload, enabled, last_run_at, next_run_at, created_at, updated_at
) VALUES (
'erli_orders_import', 300, 40, 3, NULL, 0, NULL, NOW(), NOW(), NOW()
) ON DUPLICATE KEY UPDATE
interval_seconds = VALUES(interval_seconds),
priority = VALUES(priority),
max_attempts = VALUES(max_attempts),
updated_at = NOW();