Skip to content

Add batch scan processing endpoints#215

Draft
jakebromberg wants to merge 1 commit intofeature/scanner-gemini-integrationfrom
feature/scanner-batch-processing
Draft

Add batch scan processing endpoints#215
jakebromberg wants to merge 1 commit intofeature/scanner-gemini-integrationfrom
feature/scanner-batch-processing

Conversation

@jakebromberg
Copy link
Member

Summary

  • Add POST /library/scan/batch endpoint for uploading multiple vinyl record images with a JSON manifest, returning 202 with a job ID for polling
  • Add GET /library/scan/batch/:jobId endpoint for checking job status with ownership-enforced access
  • Add scan_jobs and scan_results database tables with status enums, cascading deletes, and JSONB columns
  • Implement sequential background processing with partial failure handling (job completes if any item succeeds)
  • Validate batch limits: max 10 items, 5 images/item, 50 total images

Closes #214

Test plan

  • Unit tests for batch service (createBatchJob, getJobStatus, processJobItems) — 10 tests
  • Unit tests for controller handlers (validation, 202/400/404 responses) — 9 tests
  • Full test suite passes (204/204 tests)
  • Prettier formatting verified
  • ESLint clean (no new errors)
  • Migration SQL reviewed for correctness

Introduces POST /library/scan/batch and GET /library/scan/batch/:jobId
endpoints that let DJs upload multiple vinyl record images in one request,
get a job ID back immediately (202 Accepted), and poll for results as
each item processes asynchronously through Gemini.

Schema: scan_jobs and scan_results tables with status enums, cascading
deletes, and JSONB columns for context/extraction data.

Batch service: createBatchJob (insert + fire-and-forget background
processing), getJobStatus (ownership-checked polling), processJobItems
(sequential per-item processing with partial failure handling).

Validation: max 10 items, max 5 images per item, max 50 total images,
manifest image count must match uploaded files.
@jakebromberg jakebromberg marked this pull request as draft February 28, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant