Commit Graph

495 Commits

Author SHA1 Message Date
natib21
fea869a19c feat: display vehicle name instead of ID in fuel purchases table
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>
2026-06-30 14:23:54 +00:00
natib21
796e63cc59 fix: add missing GET /api/fuel/purchases endpoint
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>
2026-06-30 14:18:26 +00:00
natib21
f436916c42 feat: complete maintenance tracking backend
Service/Controller/Module:
- scheduleMaintenanceAsync: schedule work
- recordMaintenanceCost: log expenses
- getUpcomingMaintenance: due items
- getVehicleMaintenanceStats: cost aggregation

Endpoints:
- POST /maintenance/schedules
- POST /maintenance/costs
- PATCH /maintenance/schedules/:id
- GET /maintenance/upcoming/:vehicleId
- GET /maintenance/history/:vehicleId
- GET /maintenance/stats/:vehicleId

Migration: idempotent maintenance tables creation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 12:33:29 +00:00
natib21
e59a77b859 feat: add maintenance tracking module foundation
Entities:
- MaintenanceSchedule: track preventive/corrective maintenance
- MaintenanceCost: record actual maintenance expenses

DTOs:
- CreateMaintenanceScheduleDto: schedule maintenance
- CreateMaintenanceCostDto: log costs
- UpdateMaintenanceScheduleDto: mark complete/adjust cost

Repository:
- getUpcomingMaintenance(): find due maintenance
- getMaintenanceCosts(): historical costs by date
- getTotalMaintenanceCost(): aggregate spending

Also fixed fuel-consumption.entity.ts: totalDistanceKm default 0

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 12:28:00 +00:00
natib21
5d70c3b557 fix 2026-06-30 12:13:48 +00:00
natib21
7b9cd88712 fix: correct fuel module TypeScript errors
- Use @InjectRepository decorators for proper dependency injection
- Fix BaseRepository initialization with Repository instance
- Remove unnecessary DataSource references
- Add proper type annotations to reduce handlers

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 10:08:56 +00:00
natib21
df6e417a56 feat: add fuel management system backend
- FuelPurchase entity: record fuel purchases with cost tracking
- FuelConsumption entity: monthly aggregation of fuel metrics
- FuelService: record purchases, calculate stats, efficiency
- FuelController: REST API for fuel operations
- FuelModule: integrated into app
- Migration: create fuel_purchases and fuel_consumption tables

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-30 10:07:13 +00:00
natib21
14dde418f7 fix(migrations): check if tables exist before CREATE TABLE
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>
2026-06-30 03:55:57 +00:00
natib21
b142552f17 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/hot_fix 2026-06-30 03:46:26 +00:00
natib21
25e91c6d93 fix: comment out isPostPaymentCompleted column decorator
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>
2026-06-30 03:33:54 +00:00
natib21
f9ef473cff fix(migrations): check pg_type before CREATE TYPE enum
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>
2026-06-30 02:45:37 +00:00
natib21
76b25bd214 fix 2026-06-30 02:33:29 +00:00
natib21
1c1e98960e fix 2026-06-30 02:24:52 +00:00
natib21
ec82f8eb9f fix(migrations): use CREATE TYPE IF NOT EXISTS for invoices enum
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>
2026-06-30 02:22:09 +00:00
natib21
3ceacbe9a9 fix(migrations): use CREATE TYPE IF NOT EXISTS for invoices enum
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>
2026-06-30 02:03:20 +00:00
Nathnael
10cde2b2e3 fix 2026-06-29 19:44:40 +00:00
marshal
97992da1b5 Merge pull request #351 from Tria-plc/freight_feature/contrat
Freight feature/contrat
2026-06-29 18:49:16 +03:00
Marshal
d91389daac cfix payment 2026-06-29 15:46:17 +00:00
Marshal
ce3584cd4a cfix payment 2026-06-29 15:41:00 +00:00
natib21
04bc9eded6 fix 2026-06-29 15:28:04 +00:00
Marshal
c6979a97c2 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight_feature/contrat 2026-06-29 15:25:53 +00:00
natib21
d94b73fe02 fix 2026-06-29 15:09:34 +00:00
natib21
c728b249c2 fix 2026-06-29 14:48:47 +00:00
natib21
6fa315db0f fix 2026-06-29 14:45:22 +00:00
Nathnael
31a2e93c49 fix: rm the hardcode false for general contract 2026-06-29 14:42:53 +00:00
Nathnael Wondisha
4cf8e89780 Merge branch 'dev' into freight/feat/invoice 2026-06-29 17:24:29 +03:00
natib21
7dba546254 fix 2026-06-29 13:59:51 +00:00
Nathnael
69955bc0e6 feat: setup the invoice backend 2026-06-29 13:53:32 +00:00
natib21
8b6b6ec737 fix 2026-06-29 13:52:54 +00:00
natib21
f2826f2b9b fix 2026-06-29 13:49:01 +00:00
Nathnael
f7f0f6aef3 fix: update the invoice generation to the new booking creation 2026-06-29 13:45:35 +00:00
natib21
93ca1485c8 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/last_mile_invoice 2026-06-29 13:24:32 +00:00
natib21
0d8ed45256 fix 2026-06-29 13:24:01 +00:00
Marshal
0783ee1635 Merge branch 'freight_feature/contrat' of github.com:Tria-plc/edr-platform into freight_feature/contrat 2026-06-29 13:01:48 +00:00
Marshal
0b1e330459 add payemnt test 2026-06-29 13:00:55 +00:00
yaschalew
0d4587cf52 Merge branch 'freight/feature/last_mile_invoice' of github.com:Tria-plc/edr-platform into freight/feature/last_mile_invoice 2026-06-29 15:26:54 +03:00
natib21
fc95d48d28 fix 2026-06-29 12:25:36 +00:00
marshal
4e632123c0 Merge pull request #340 from Tria-plc/freight_feature/contrat
payemnt
2026-06-29 15:21:01 +03:00
marshal
6685a3ba76 payemnt 2026-06-29 15:17:51 +03:00
natib21
aac790292b Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/last_mile_invoice 2026-06-29 12:15:53 +00:00
natib21
a64e531324 fix 2026-06-29 12:15:30 +00:00
yaschalew
75ff175538 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/last_mile_invoice 2026-06-29 15:09:20 +03:00
marshal
f958a7639a Merge pull request #336 from Tria-plc/freight_feature/contrat
payemnt
2026-06-29 15:08:50 +03:00
natib21
b22ab739db fix 2026-06-29 12:08:16 +00:00
marshal
09e1429c38 payemnt 2026-06-29 15:08:12 +03:00
marshal
1795bb8830 Merge pull request #335 from Tria-plc/freight_feature/contrat
Freight feature/contrat
2026-06-29 15:07:25 +03:00
marshal
b688a76550 payemnt 2026-06-29 15:05:50 +03:00
marshal
1491db304b payemnt 2026-06-29 15:04:01 +03:00
yaschalew10
db7f0cb601 Merge pull request #334 from Tria-plc/freight/feature/last_mile_invoice
Freight/feature/last mile invoice
2026-06-29 15:03:00 +03:00
natib21
5c36c09dae fix 2026-06-29 12:01:19 +00:00