Backend:
- FuelService.getAllFuelPurchases() now loads vehicle relationship
- Uses leftJoinAndSelect to eagerly load Vehicle data
- Returns complete FuelPurchase with nested vehicle object
Frontend:
- Table displays vehicle.registrationNumber (primary)
- Falls back to vehicle.plateNumber if registration unavailable
- Falls back to vehicleId as last resort
Better UX: shows human-readable vehicle info instead of UUID.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Problem:
- Frontend calls GET /fuel/purchases (all purchases)
- Backend only had GET /fuel/purchases/:vehicleId (specific vehicle)
- Result: 404 when loading fuel purchases list
Solution:
- Added getAllFuelPurchases() to FuelService
- Added GET /fuel/purchases route to FuelController
- Route placed before parameterized route so it gets matched first
- Returns all fuel purchases ordered by date DESC
Endpoints:
- GET /api/fuel/purchases → all purchases
- GET /api/fuel/purchases/:vehicleId → specific vehicle
- POST /api/fuel/purchases → record purchase
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Make invoices migration idempotent - skip table/index creation if they
already exist. Prevents 'relation already exists' errors on redeployment.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Column doesn't exist in DB yet. Commenting out @Column decorator
prevents TypeORM from trying to select non-existent column.
Fixes 500 QueryFailedError on first-mile/last-mile list endpoints.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PostgreSQL doesn't support IF NOT EXISTS on CREATE TYPE AS ENUM.
Query pg_type table to check if enum exists before creating.
Compatible with all PostgreSQL versions.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Allows migration to run when enum already exists in prod DB. Prevents
'type already exists' error on redeployment.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Allows migration to run when enum already exists in prod DB. Prevents
'type already exists' error on redeployment.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>