Files
motovaultpro/backend/src/features/documents
Eric Gullickson e6af7ed5d5 feat: add batch insert operations to repositories (refs #26)
Add batchInsert methods to vehicles, fuel-logs, maintenance, and documents repositories. Multi-value INSERT syntax provides 10-100x performance improvement over individual operations for bulk data import.

- vehicles.repository: batchInsert for vehicles
- fuel-logs.repository: batchInsert for fuel logs
- maintenance.repository: batchInsertRecords and batchInsertSchedules
- documents.repository: batchInsert for documents
- All methods support empty array (immediate return) and optional transaction client
- Fix lint error: replace require() with ES6 import in test mock

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-11 19:28:11 -06:00
..
2025-09-28 20:35:46 -05:00
2025-11-04 18:38:06 -06:00

Documents Feature Capsule

Quick Summary (50 tokens)

Secure vehicle document management with filesystem storage. Metadata and file uploads with private access, user and vehicle ownership enforcement, and mobile-first UX.

API Endpoints

  • GET /api/documents
  • GET /api/documents/:id
  • POST /api/documents
  • PUT /api/documents/:id
  • DELETE /api/documents/:id
  • GET /api/documents/vehicle/:vehicleId
  • POST /api/documents/:id/upload
  • GET /api/documents/:id/download

Structure

  • api/ - HTTP endpoints, routes, validators
  • domain/ - Business logic, types, rules
  • data/ - Repository, database queries
  • migrations/ - Feature-specific schema
  • tests/ - All feature tests

Dependencies

  • Internal: core/auth (JWT validation), core/storage (filesystem adapter), core/logging
  • Database: documents table
  • Storage: Filesystem adapter (/app/data/documents)

Quick Commands

# Run feature tests
npm test -- features/documents

# Run migrations (all features)
npm run migrate:all