Skip to content

Add GET /library/scan/batch endpoint to list batch jobs #216

@jakebromberg

Description

@jakebromberg

Summary

Add a paginated endpoint for listing a user's batch scan jobs. This supports the HistoryView in the library-scanner iOS app, which needs to display past batch jobs without fetching full results for each one.

Changes

Service (apps/backend/services/scanner/batch.ts)

  • Add BatchJobSummary and PaginatedJobList interfaces
  • Add listJobs(userId, limit, offset) function that queries scan_jobs with WHERE user_id = ?, ordered by created_at DESC, with LIMIT/OFFSET pagination and total count

Controller (apps/backend/controllers/scanner.controller.ts)

  • Add listBatchJobs handler that parses limit (default 20, max 100) and offset (default 0) from query params

Routes (apps/backend/routes/scanner.route.ts)

  • Add GET /batch route before the :jobId route (Express matches first), requiring catalog: read permission

Tests

7 new tests:

  • Service: empty result, sorted order, limit/offset params, field mapping (4 tests)
  • Controller: 200 response, default pagination, limit clamping (3 tests)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestscannerVinyl scanner and batch processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions