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
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)BatchJobSummaryandPaginatedJobListinterfaceslistJobs(userId, limit, offset)function that queriesscan_jobswithWHERE user_id = ?, ordered bycreated_at DESC, withLIMIT/OFFSETpagination and total countController (
apps/backend/controllers/scanner.controller.ts)listBatchJobshandler that parseslimit(default 20, max 100) andoffset(default 0) from query paramsRoutes (
apps/backend/routes/scanner.route.ts)GET /batchroute before the:jobIdroute (Express matches first), requiringcatalog: readpermissionTests
7 new tests:
Related
feature/scanner-batch-processing(PR Add batch scan processing endpoints #215)