33 lines
772 B
TypeScript
33 lines
772 B
TypeScript
import { api } from '$lib/api';
|
|
|
|
export interface Vehicle {
|
|
vehicle_key: string;
|
|
brand?: string;
|
|
plate_number?: string;
|
|
description?: string;
|
|
transport_type?: string;
|
|
year?: string;
|
|
}
|
|
|
|
export interface VehicleListResponse {
|
|
items: Vehicle[];
|
|
total: number;
|
|
}
|
|
|
|
/**
|
|
* API para Vehículos
|
|
*/
|
|
export const vehiclesApi = {
|
|
list: (companyId: string, page = 1, pageSize = 50) => {
|
|
return api.get<VehicleListResponse>(
|
|
`/v1/a76/transportation/vehicles?company_id=${companyId}&page=${page}&page_size=${pageSize}`
|
|
);
|
|
},
|
|
|
|
get: (vehicleKey: string, companyId: string) => {
|
|
return api.get<Vehicle>(
|
|
`/v1/a76/transportation/vehicles/${vehicleKey}?company_id=${companyId}`
|
|
);
|
|
}
|
|
};
|