Merge origin/development into fix/bug-pedimento
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { api } from '$lib/api';
|
||||
import { companyStore } from '$lib/stores/company.svelte'; // <--- NUEVO: Importamos el store para el fallback
|
||||
import type { ApiResponse } from '$lib/api';
|
||||
|
||||
export interface CustomsBroker {
|
||||
@@ -26,6 +27,8 @@ export interface CustomsBroker {
|
||||
}
|
||||
|
||||
export interface CustomsBrokerVU {
|
||||
tenant_id?: string | null;
|
||||
company_id?: string | null;
|
||||
certificate_path?: string | null;
|
||||
key_path?: string | null;
|
||||
access_key?: string | null;
|
||||
@@ -95,7 +98,9 @@ export interface CustomsBrokerListResponse {
|
||||
*/
|
||||
export const customsBrokersApi = {
|
||||
list: (companyId: string, page = 1, pageSize = 50) => {
|
||||
return api.get<CustomsBrokerListResponse>(`/v1/a76/customs-brokers?company_id=${companyId}&page=${page}&page_size=${pageSize}`);
|
||||
return api.get<CustomsBrokerListResponse>(
|
||||
`/v1/a76/customs-brokers?company_id=${companyId}&page=${page}&page_size=${pageSize}`
|
||||
);
|
||||
},
|
||||
|
||||
get: (brokerKey: string, companyId: string) => {
|
||||
@@ -111,20 +116,47 @@ export const customsBrokersApi = {
|
||||
*/
|
||||
update: (brokerKey: string, data: CreateCustomsBrokerData) => {
|
||||
const companyId = data.company_id;
|
||||
return api.put<CustomsBroker>(`/v1/a76/customs-brokers/${brokerKey}/?company_id=${companyId}`, data);
|
||||
return api.put<CustomsBroker>(
|
||||
`/v1/a76/customs-brokers/${brokerKey}/?company_id=${companyId}`,
|
||||
data
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Elimina un agente aduanal
|
||||
*/
|
||||
delete: (brokerKey: string, companyId: string) => {
|
||||
return api.delete<CustomsBroker>(`/v1/a76/customs-brokers/${brokerKey}?company_id=${companyId}`);
|
||||
return api.delete<CustomsBroker>(
|
||||
`/v1/a76/customs-brokers/${brokerKey}?company_id=${companyId}`
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Actualiza la información de Ventanilla Única (VU)
|
||||
*/
|
||||
updateVU: (brokerKey: string, data: CustomsBrokerVU, companyId: string) => {
|
||||
return api.put<CustomsBrokerVU>(`/v1/a76/customs-broker-vu/${brokerKey}?company_id=${companyId}`, data);
|
||||
// LOGICA DE RESCATE:
|
||||
// Si companyId llega nulo/undefined, intentamos obtenerlo del store global
|
||||
let finalCompanyId = companyId;
|
||||
|
||||
if (!finalCompanyId && companyStore.activeCompany?.id) {
|
||||
finalCompanyId = companyStore.activeCompany.id.toString();
|
||||
console.warn("WARN: companyId no fue provisto a updateVU, usando companyStore:", finalCompanyId);
|
||||
}
|
||||
|
||||
// Aseguramos que el payload tenga los IDs
|
||||
const payload = {
|
||||
...data,
|
||||
company_id: finalCompanyId,
|
||||
tenant_id: finalCompanyId
|
||||
};
|
||||
|
||||
console.log('[DEBUG] Enviando payload VU:', payload);
|
||||
|
||||
return api.put<CustomsBrokerVU>(
|
||||
`/v1/a76/customs-broker-vu/${brokerKey}?company_id=${finalCompanyId}`,
|
||||
payload
|
||||
);
|
||||
},
|
||||
|
||||
updatePersonnel: (brokerKey: string, line: number, data: CustomsBrokerPersonnel, companyId: string) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface LineCustoms {
|
||||
destination_country?: string;
|
||||
advalorem?: string;
|
||||
advalorem_numeric?: number;
|
||||
advalorem_american?: number;
|
||||
advalorem_american?: number;
|
||||
advalorem_tlcan?: number;
|
||||
rate?: string;
|
||||
depreciation_rate?: number;
|
||||
@@ -33,7 +33,7 @@ export interface LineFinancials {
|
||||
unit_cost_mxn?: number;
|
||||
unit_cost_capture?: number;
|
||||
unit_cost_commercial_usd?: number;
|
||||
|
||||
|
||||
// Values
|
||||
value_mc?: number;
|
||||
value_usd?: number;
|
||||
@@ -49,7 +49,7 @@ export interface LineQuantities {
|
||||
line_item_id?: number;
|
||||
quantity?: number;
|
||||
unit_of_measure?: string;
|
||||
|
||||
|
||||
// Special quantities
|
||||
quantity_temp_export?: number;
|
||||
quantity_returned?: number;
|
||||
@@ -92,7 +92,7 @@ export interface FaLineItem {
|
||||
id?: number;
|
||||
tenant_id?: number;
|
||||
company_id?: number;
|
||||
|
||||
|
||||
// Asset information (SCAF specific)
|
||||
asset_number?: string;
|
||||
asset_photo?: string;
|
||||
@@ -101,44 +101,46 @@ export interface FaLineItem {
|
||||
return_import_invoice?: string;
|
||||
return_import_date?: number;
|
||||
movement_type_import?: string;
|
||||
|
||||
|
||||
// Cross-references for import repair
|
||||
search_invoice?: string;
|
||||
search_line?: number;
|
||||
|
||||
|
||||
// Search type
|
||||
search_type?: string;
|
||||
|
||||
// Subitems
|
||||
is_subitem?: boolean;
|
||||
contains_subitems?: boolean;
|
||||
subitem_number?: number;
|
||||
|
||||
// Subitems
|
||||
is_subitem?: boolean;
|
||||
contains_subitems?: boolean;
|
||||
subitem_number?: number;
|
||||
|
||||
// Special flags
|
||||
download?: boolean;
|
||||
own_equipment?: boolean;
|
||||
omit_annex31?: boolean;
|
||||
|
||||
omit_annex31?: boolean;
|
||||
|
||||
// Timestamps
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface Item {
|
||||
id?: number;
|
||||
invoice_id: number;
|
||||
id?: number;
|
||||
invoice_id: number;
|
||||
line_number: number;
|
||||
|
||||
|
||||
// Identification
|
||||
part_number?: string;
|
||||
part_number_id?: number;
|
||||
component_part_number?: string;
|
||||
component_part_number_id?: number;
|
||||
class_id?: number;
|
||||
identifier?: string;
|
||||
|
||||
// Unit of Measure
|
||||
unit_of_measure?: number;
|
||||
alternate_unit?: number;
|
||||
|
||||
|
||||
// Permits
|
||||
permit_number?: string;
|
||||
page_line?: string;
|
||||
@@ -151,29 +153,29 @@ export interface Item {
|
||||
includes_subitems?: boolean;
|
||||
tax_payment?: boolean;
|
||||
is_military_mcia?: boolean;
|
||||
|
||||
|
||||
// Payment
|
||||
payment_method?: string;
|
||||
igi_amount?: number;
|
||||
|
||||
|
||||
// Additional notes
|
||||
wildcard_field?: string;
|
||||
|
||||
// Computed fields from class_info relation
|
||||
class_code?: string;
|
||||
class_description?: string;
|
||||
|
||||
|
||||
// Computed field from unit_of_measure_info relation
|
||||
unit_of_measure_code?: string;
|
||||
reference_number?: string;
|
||||
order?: string;
|
||||
guide_number?: string;
|
||||
depreciation_date?: number;
|
||||
rectification?: number;
|
||||
warehouse?: string;
|
||||
location?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
unit_of_measure_code?: string;
|
||||
reference_number?: string;
|
||||
order?: string;
|
||||
guide_number?: string;
|
||||
depreciation_date?: number;
|
||||
rectification?: number;
|
||||
warehouse?: string;
|
||||
location?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
|
||||
// Nested relations (Singular names to match backend Pydantic models)
|
||||
customs?: LineCustoms;
|
||||
@@ -185,86 +187,86 @@ export interface Item {
|
||||
}
|
||||
|
||||
export interface ItemListResponse {
|
||||
items: Item[];
|
||||
total: number;
|
||||
skip: number;
|
||||
limit: number;
|
||||
items: Item[];
|
||||
total: number;
|
||||
skip: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export interface CreateItemData extends Omit<Item, 'id' | 'created_at' | 'updated_at'> {
|
||||
invoice_id: number;
|
||||
invoice_id: number;
|
||||
}
|
||||
|
||||
export interface UpdateItemData extends Partial<Omit<Item, 'id' | 'invoice_id' | 'created_at' | 'updated_at'>> {}
|
||||
export interface UpdateItemData extends Partial<Omit<Item, 'id' | 'invoice_id' | 'created_at' | 'updated_at'>> { }
|
||||
|
||||
/**
|
||||
* API para Items
|
||||
*/
|
||||
export const itemsApi = {
|
||||
/**
|
||||
* Lista todos los items con paginación
|
||||
*/
|
||||
list: (companyId: number, skip = 0, limit = 100, invoiceId?: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString(),
|
||||
skip: skip.toString(),
|
||||
limit: limit.toString()
|
||||
});
|
||||
/**
|
||||
* Lista todos los items con paginación
|
||||
*/
|
||||
list: (companyId: number, skip = 0, limit = 100, invoiceId?: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString(),
|
||||
skip: skip.toString(),
|
||||
limit: limit.toString()
|
||||
});
|
||||
|
||||
if (invoiceId) {
|
||||
params.append('invoice_id', invoiceId.toString());
|
||||
}
|
||||
if (invoiceId) {
|
||||
params.append('invoice_id', invoiceId.toString());
|
||||
}
|
||||
|
||||
return api.get<ItemListResponse>(`/v1/a76/items/?${params.toString()}`);
|
||||
},
|
||||
return api.get<ItemListResponse>(`/v1/a76/items/?${params.toString()}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Lista items por invoice ID
|
||||
*/
|
||||
listByInvoice: (invoiceId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<ItemListResponse>(`/v1/a76/items/invoice/${invoiceId}/items/?${params.toString()}`);
|
||||
},
|
||||
/**
|
||||
* Lista items por invoice ID
|
||||
*/
|
||||
listByInvoice: (invoiceId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<ItemListResponse>(`/v1/a76/items/invoice/${invoiceId}/items/?${params.toString()}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtiene un item por ID
|
||||
*/
|
||||
get: (itemId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<Item>(`/v1/a76/items/${itemId}/?${params.toString()}`);
|
||||
},
|
||||
/**
|
||||
* Obtiene un item por ID
|
||||
*/
|
||||
get: (itemId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<Item>(`/v1/a76/items/${itemId}/?${params.toString()}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Crea un nuevo item
|
||||
*/
|
||||
create: (companyId: number, data: CreateItemData) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Item>(`/v1/a76/items/?${params.toString()}`, data);
|
||||
},
|
||||
/**
|
||||
* Crea un nuevo item
|
||||
*/
|
||||
create: (companyId: number, data: CreateItemData) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Item>(`/v1/a76/items/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
/**
|
||||
* Actualiza un item existente
|
||||
*/
|
||||
update: (itemId: number, companyId: number, data: UpdateItemData) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.put<Item>(`/v1/a76/items/${itemId}/?${params.toString()}`, data);
|
||||
},
|
||||
/**
|
||||
* Actualiza un item existente
|
||||
*/
|
||||
update: (itemId: number, companyId: number, data: UpdateItemData) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.put<Item>(`/v1/a76/items/${itemId}/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
/**
|
||||
* Elimina un item
|
||||
*/
|
||||
delete: (itemId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete(`/v1/a76/items/${itemId}/?${params.toString()}`);
|
||||
}
|
||||
/**
|
||||
* Elimina un item
|
||||
*/
|
||||
delete: (itemId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete(`/v1/a76/items/${itemId}/?${params.toString()}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface PedimentoPayments {
|
||||
}
|
||||
|
||||
export interface PedimentoTransportMeans {
|
||||
id?: number;
|
||||
destination?: number | null;
|
||||
entry_exit?: string | null;
|
||||
arrival?: string | null;
|
||||
@@ -40,6 +41,7 @@ export interface PedimentoTransportMeans {
|
||||
}
|
||||
|
||||
export interface PedimentoCustomsOffices {
|
||||
id?: number;
|
||||
dispatch_customs?: string | null;
|
||||
entry_exit_customs?: string | null;
|
||||
}
|
||||
@@ -185,6 +187,7 @@ export interface Pedimento {
|
||||
pedimento_incrementables?: PedimentoIncrementables | null;
|
||||
pedimento_decrementables?: PedimentoDecrementables | null;
|
||||
pedimento_indexes?: PedimentoIndexes | null;
|
||||
pedimento_customs_offices?: PedimentoCustomsOffices | null;
|
||||
pedimento_config_additional?: PedimentoConfigAdditional | null;
|
||||
pedimento_config_calculations?: PedimentoConfigCalculations | null;
|
||||
pedimento_config_surcharges?: PedimentoConfigSurcharges | null;
|
||||
@@ -226,6 +229,7 @@ export interface CreatePedimentoData {
|
||||
pedimento_incrementables?: PedimentoIncrementables | null;
|
||||
pedimento_decrementables?: PedimentoDecrementables | null;
|
||||
pedimento_indexes?: PedimentoIndexes | null;
|
||||
pedimento_customs_offices?: PedimentoCustomsOffices | null;
|
||||
pedimento_config_additional?: PedimentoConfigAdditional | null;
|
||||
pedimento_config_calculations?: PedimentoConfigCalculations | null;
|
||||
pedimento_config_surcharges?: PedimentoConfigSurcharges | null;
|
||||
@@ -260,6 +264,7 @@ export interface UpdatePedimentoData {
|
||||
pedimento_incrementables?: PedimentoIncrementables | null;
|
||||
pedimento_decrementables?: PedimentoDecrementables | null;
|
||||
pedimento_indexes?: PedimentoIndexes | null;
|
||||
pedimento_customs_offices?: PedimentoCustomsOffices | null;
|
||||
pedimento_config_additional?: PedimentoConfigAdditional | null;
|
||||
pedimento_config_calculations?: PedimentoConfigCalculations | null;
|
||||
pedimento_config_surcharges?: PedimentoConfigSurcharges | null;
|
||||
|
||||
@@ -2,10 +2,17 @@ import { api, type ApiResponse } from '$lib/api';
|
||||
|
||||
export interface Trailer {
|
||||
trailer_number: string;
|
||||
plate_number?: string;
|
||||
ace_trailer_number?: string;
|
||||
trailer_type_key?: string;
|
||||
is_active: boolean;
|
||||
tenant_id?: string;
|
||||
seal?: string;
|
||||
entity_code?: string;
|
||||
plate_number?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
container_key?: string;
|
||||
is_active?: boolean;
|
||||
company_id?: number | string;
|
||||
tenant_id?: number | string;
|
||||
}
|
||||
|
||||
export interface TrailerResponse {
|
||||
@@ -16,7 +23,7 @@ export interface TrailerResponse {
|
||||
}
|
||||
|
||||
class TrailersApi {
|
||||
private baseUrl = '/v1/a76/trailers';
|
||||
private baseUrl = '/v1/a76/transportation/trailers';
|
||||
|
||||
async list(
|
||||
companyId: string | number,
|
||||
@@ -35,6 +42,27 @@ class TrailersApi {
|
||||
});
|
||||
return api.get<Trailer>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
|
||||
async create(data: Trailer, companyId: string | number): Promise<ApiResponse<Trailer>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Trailer>(`${this.baseUrl}?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: Trailer, companyId: string | number): Promise<ApiResponse<Trailer>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.put<Trailer>(`${this.baseUrl}/${id}/?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string, companyId: string | number): Promise<ApiResponse<void>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete<void>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const trailersApi = new TrailersApi();
|
||||
|
||||
@@ -2,10 +2,26 @@ import { api, type ApiResponse } from '$lib/api';
|
||||
|
||||
export interface Transporter {
|
||||
transporter_key: string;
|
||||
name: string;
|
||||
name?: string;
|
||||
short_name?: string;
|
||||
responsible?: string;
|
||||
rfc?: string;
|
||||
is_active: boolean;
|
||||
tenant_id?: string;
|
||||
streets?: string;
|
||||
postal_code?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
loader_code?: string;
|
||||
caat_code?: string;
|
||||
transport_code?: string;
|
||||
transport_interface_type?: string;
|
||||
ftp_server?: string;
|
||||
ftp_user?: string;
|
||||
ftp_password?: string;
|
||||
ftp_directory?: string;
|
||||
filler_code?: string;
|
||||
company_id?: number | string;
|
||||
tenant_id?: number | string;
|
||||
}
|
||||
|
||||
export interface TransporterResponse {
|
||||
@@ -35,6 +51,27 @@ class TransportersApi {
|
||||
});
|
||||
return api.get<Transporter>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
|
||||
async create(data: Transporter, companyId: string | number): Promise<ApiResponse<Transporter>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Transporter>(`${this.baseUrl}?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: Transporter, companyId: string | number): Promise<ApiResponse<Transporter>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.put<Transporter>(`${this.baseUrl}/${id}/?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string, companyId: string | number): Promise<ApiResponse<void>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete<void>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const transportersApi = new TransportersApi();
|
||||
|
||||
@@ -1,32 +1,84 @@
|
||||
import { api } from '$lib/api';
|
||||
import { api, type ApiResponse } from '$lib/api';
|
||||
|
||||
export interface Vehicle {
|
||||
vehicle_key: string;
|
||||
brand?: string;
|
||||
plate_number?: string;
|
||||
description?: string;
|
||||
ace_vehicle_key?: string;
|
||||
transporter_key?: string;
|
||||
transport_identifier?: string;
|
||||
transport_type?: string;
|
||||
entity_code?: string;
|
||||
transponder_number?: string;
|
||||
dot_number?: string;
|
||||
plate_number?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
country?: string;
|
||||
seal?: string;
|
||||
insurance_company_name?: string;
|
||||
insurance_number?: string;
|
||||
insurance_amount?: number;
|
||||
insurance_date?: number;
|
||||
box_number?: string;
|
||||
brand?: string;
|
||||
year?: string;
|
||||
series?: string;
|
||||
description?: string;
|
||||
engine_number?: string;
|
||||
sct_permission?: string;
|
||||
color?: string;
|
||||
container_key?: string;
|
||||
company_id?: number | string;
|
||||
tenant_id?: number | string;
|
||||
}
|
||||
|
||||
export interface VehicleListResponse {
|
||||
export interface VehicleResponse {
|
||||
items: Vehicle[];
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: 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}`
|
||||
);
|
||||
},
|
||||
class VehiclesApi {
|
||||
private baseUrl = '/v1/a76/transportation/vehicles';
|
||||
|
||||
get: (vehicleKey: string, companyId: string) => {
|
||||
return api.get<Vehicle>(
|
||||
`/v1/a76/transportation/vehicles/${vehicleKey}?company_id=${companyId}`
|
||||
);
|
||||
async list(
|
||||
companyId: string | number,
|
||||
params?: Record<string, any>
|
||||
): Promise<ApiResponse<VehicleResponse>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString(),
|
||||
...params
|
||||
});
|
||||
return api.get<VehicleResponse>(`${this.baseUrl}?${queryParams.toString()}`);
|
||||
}
|
||||
};
|
||||
|
||||
async get(id: string, companyId: string | number): Promise<ApiResponse<Vehicle>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<Vehicle>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
|
||||
async create(data: Vehicle, companyId: string | number): Promise<ApiResponse<Vehicle>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Vehicle>(`${this.baseUrl}?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: Vehicle, companyId: string | number): Promise<ApiResponse<Vehicle>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.put<Vehicle>(`${this.baseUrl}/${id}/?${queryParams.toString()}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string, companyId: string | number): Promise<ApiResponse<void>> {
|
||||
const queryParams = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete<void>(`${this.baseUrl}/${id}?${queryParams.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const vehiclesApi = new VehiclesApi();
|
||||
|
||||
Reference in New Issue
Block a user