Merge freight/develop into feature/trains-management

This commit is contained in:
hagiye
2026-06-05 10:21:39 +03:00
179 changed files with 12700 additions and 3160 deletions

View 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`),
};