From 4f383280318e9685d7e5d81c02f16a83850efda7 Mon Sep 17 00:00:00 2001 From: acazares Date: Wed, 14 Jan 2026 17:33:54 -0600 Subject: [PATCH] refactor(customs-brokers): streamline CustomsBroker interface and update API methods --- .../lib/api/dashboard/a76/customs-brokers.ts | 42 ++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/frontend/src/lib/api/dashboard/a76/customs-brokers.ts b/frontend/src/lib/api/dashboard/a76/customs-brokers.ts index a3faa96e..f91acdcb 100644 --- a/frontend/src/lib/api/dashboard/a76/customs-brokers.ts +++ b/frontend/src/lib/api/dashboard/a76/customs-brokers.ts @@ -1,26 +1,7 @@ import { api } from '$lib/api'; import type { ApiResponse } from '$lib/api'; -export interface CustomsBroker { - type?: string | null; - broker_key: string; - name?: string | null; - address?: string | null; - postal_code?: string | null; - city?: string | null; - state?: string | null; - phone?: string | null; - fax?: string | null; - email?: string | null; - country?: string | null; - tax_id?: string | null; - personal_id?: string | null; - position?: string | null; - license: string; - company?: string | null; - contact?: string | null; - tenant_id: string; - company_id: string; +export interface CustomsBroker { id: number; type?: string | null; broker_key: string; @@ -117,13 +98,14 @@ export const customsBrokersApi = { return api.post(`/v1/a76/customs-brokers/?company_id=${companyId}`, data); }, - update: (brokerKey: string, data: CreateCustomsBrokerData, companyId: string) => { - return api.patch(`/v1/a76/customs-brokers/${brokerKey}?company_id=${companyId}`, data); - }, + /** + * Actualiza la información de un agente aduanal + */ + update: (brokerKey: string, data: CreateCustomsBrokerData) => { + const companyId = data.company_id; + return api.put(`/v1/a76/customs-brokers/${brokerKey}/?company_id=${companyId}`, data); + }, - delete: (brokerKey: string, companyId: string) => { - return api.delete(`/v1/a76/customs-brokers/${brokerKey}?company_id=${companyId}`); - }, /** * Elimina un agente aduanal */ @@ -131,13 +113,7 @@ export const customsBrokersApi = { return api.delete(`/v1/a76/customs-brokers/${brokerKey}/?company_id=${companyId}`); }, - /** - * Actualiza la información de un agente aduanal - */ - update: (brokerKey: string, data: CreateCustomsBrokerData) => { - const companyId = data.company_id; - return api.put(`/v1/a76/customs-brokers/${brokerKey}/?company_id=${companyId}`, data); - }, + updateVU: (brokerKey: string, data: CustomsBrokerVU, companyId: string) => { return api.put(`/v1/a76/customs-broker-vu/${brokerKey}?company_id=${companyId}`, data);