Commit Graph
2 Commits
Author SHA1 Message Date
objecttothis 90e68714f0 feat(jobs): add batch-level import context and queue pause support
- Add import_batch_contexts table plus ImportBatchContext model so
  per-batch data (e.g. Items CSV attribute definitions) is stored
  once and referenced by context_id, instead of duplicated into
  every queued row's job payload.
- Extend queue_jobs, queue_jobs_failed, and new queue_paused_jobs
  tables with batch_id/context_id columns and FKs (ON DELETE
  RESTRICT) back to import_batch_contexts, so context rows cannot
  be purged while any job still references them.
- Introduce ImportBatchService.pushRow() to centralize queuing a
  batch row with batch/context stamping and priority; update
  Customers and Items controllers to use it instead of calling
  importBatch->create() and queue->push() separately.
- Add queue_paused_jobs table and Jobs::postPauseJobs()/pauseQueues()
  to move pending jobs out of queue_jobs into a paused table per
  queue (all core queues or a selected subset), leaving in-flight
  jobs untouched (issue #3833 pause/resume design).
- Change Jobs::getEditJob()/postSaveJob() routes to accept separate
  source/id path segments instead of a combined uid string.
- Add test coverage for ImportBatchContext, ImportBatchService, and
  ImportBatch (including purge-retains-while-referenced guards).

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-10-01 16:07:04 +04:00
objecttothisandClaude Sonnet 5 bffeeb117a feat(customers,items): queue CSV imports as background jobs
Replaces the synchronous CSV import loop in Customers and Items with one
queued job per row (CustomerImportJob / ItemImportJob, processed via
CustomerCsvRowProcessor / ItemCsvRowProcessor). Only structural checks
that would make every row's job meaningless (upload failure, missing or
mismatched headers) are done in the controller; per-row validation
happens in the job itself so one bad row can't block the rest of the
file. ImportBatch / ImportBatchService track per-import progress so
completion can be reported once all rows finish.

Issue #3833 Phase 3.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-24 20:00:34 +04:00