mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 19:30:57 +00:00
feat: add fleet-wide fuel and maintenance stats endpoints
Backend: FuelService + FuelController: - Added getFleetFuelStats() aggregating all vehicles - Route: GET /api/fuel/stats (before :vehicleId route) - Returns: totalCost, totalLiters, totalPurchases, averagePricePerLiter MaintenanceService + MaintenanceController: - Added getFleetMaintenanceStats() aggregating all vehicles - Route: GET /api/maintenance/stats (before :vehicleId route) - Returns: totalCost, numberOfMaintenanceItems, averageCostPerMaintenance, costByType Both endpoints aggregate over past 12 months (customizable via query param). Enables dashboard to show fleet-wide operating costs. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,12 @@ export class FuelController {
|
||||
return this.fuelService.getMonthlyConsumption(vehicleId, new Date(month));
|
||||
}
|
||||
|
||||
@Get('stats')
|
||||
@ApiOperation({ summary: 'Get fleet-wide fuel statistics' })
|
||||
async getFleetFuelStats(@Query('months') months: number = 12) {
|
||||
return this.fuelService.getFleetFuelStats(months);
|
||||
}
|
||||
|
||||
@Get('stats/:vehicleId')
|
||||
@ApiOperation({ summary: 'Get fuel statistics for vehicle' })
|
||||
async getVehicleFuelStats(
|
||||
|
||||
Reference in New Issue
Block a user