mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
fix
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { api as apiClient } from "../auth/http";
|
||||
|
||||
export type FleetEventType =
|
||||
| "DRIVER_REGISTERED"
|
||||
| "VEHICLE_REGISTERED"
|
||||
| "DRIVER_ASSIGNED"
|
||||
| "DRIVER_UNASSIGNED"
|
||||
| "VEHICLE_STATUS_CHANGED"
|
||||
| "VEHICLE_AVAILABILITY_CHANGED"
|
||||
| "MILE_VEHICLE_ASSIGNED"
|
||||
| "MILE_VEHICLE_RELEASED"
|
||||
| "MILE_STATUS_CHANGED";
|
||||
|
||||
export interface FleetHistoryEvent {
|
||||
id: string;
|
||||
eventType: FleetEventType;
|
||||
vehicleId?: string | null;
|
||||
driverId?: string | null;
|
||||
firstMileId?: string | null;
|
||||
lastMileId?: string | null;
|
||||
fromValue?: string | null;
|
||||
toValue?: string | null;
|
||||
label?: string | null;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
/** Timeline of fleet events for a driver or a vehicle (newest first). */
|
||||
export const fleetHistoryService = {
|
||||
driver: (id: string) =>
|
||||
apiClient
|
||||
.get<FleetHistoryEvent[]>(`/drivers/${id}/history`)
|
||||
.then((r) => r.data),
|
||||
vehicle: (id: string) =>
|
||||
apiClient
|
||||
.get<FleetHistoryEvent[]>(`/vehicles/${id}/history`)
|
||||
.then((r) => r.data),
|
||||
};
|
||||
Reference in New Issue
Block a user