mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
Merge freight/develop into feature/trains-management
This commit is contained in:
26
apps/edr-freight-web/backoffice/src/services/cargoService.ts
Normal file
26
apps/edr-freight-web/backoffice/src/services/cargoService.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { apiClient } from '@/lib/axios';
|
||||
|
||||
export interface Cargo {
|
||||
id: string;
|
||||
cargoReference: string;
|
||||
shipmentId: string;
|
||||
containerId: string;
|
||||
cargoTypeId?: string;
|
||||
description?: string;
|
||||
quantity: number;
|
||||
weight: number;
|
||||
volume?: number;
|
||||
status: 'PENDING' | 'LOADED' | 'IN_TRANSIT' | 'DELIVERED' | 'UNLOADED';
|
||||
loadedAt?: string;
|
||||
unloadedAt?: string;
|
||||
}
|
||||
|
||||
export const cargoService = {
|
||||
getAll: () => apiClient.get<Cargo[]>('/cargoes'),
|
||||
getByContainer: (containerId: string) => apiClient.get<Cargo[]>(`/cargoes?containerId=${containerId}`),
|
||||
create: (data: any) => apiClient.post('/cargoes', data),
|
||||
load: (cargoId: string, quantity: number, weight: number, volume?: number) =>
|
||||
apiClient.post(`/cargoes/${cargoId}/load`, { quantity, weight, volume }),
|
||||
deliver: (cargoId: string) => apiClient.post(`/cargoes/${cargoId}/deliver`),
|
||||
unload: (cargoId: string) => apiClient.post(`/cargoes/${cargoId}/unload`),
|
||||
};
|
||||
Reference in New Issue
Block a user