mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 12:00:59 +00:00
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
// import { apiClient } from '@/lib/axios';
|
|
import { api as apiClient } from "../auth/http";
|
|
|
|
|
|
export interface Container {
|
|
id: string;
|
|
containerNumber: string;
|
|
containerTypeId: string;
|
|
wagonId: string | null;
|
|
position: number | null;
|
|
tareWeight: number;
|
|
maxGrossWeight: number;
|
|
sealNumber?: string;
|
|
status: string;
|
|
}
|
|
|
|
export const containerService = {
|
|
getAll: () => apiClient.get<Container[]>('/containers'),
|
|
getById: (id: string) => apiClient.get<Container>(`/containers/${id}`),
|
|
getByWagon: (wagonId: string) => apiClient.get<Container[]>(`/containers?wagonId=${wagonId}`),
|
|
create: (data: Partial<Container>) => apiClient.post('/containers', data),
|
|
update: (id: string, data: Partial<Container>) => apiClient.patch(`/containers/${id}`, data),
|
|
delete: (id: string) => apiClient.delete(`/containers/${id}`),
|
|
assignToWagon: (containerId: string, wagonId: string, position?: number) =>
|
|
apiClient.post(`/containers/${containerId}/assign-wagon`, { wagonId, position }),
|
|
unassign: (containerId: string) => apiClient.post(`/containers/${containerId}/unassign-wagon`),
|
|
};
|