feat: Enhance Pedimentos CRUD operations with related data handling
- Updated PedimentosService to create and update related tables for Pedimentos. - Added company_id filtering in queries for Pedimentos. - Improved error handling and logging during creation and update processes. - Refactored router tags for consistency and clarity. - Adjusted API endpoints for customs brokers to include company_id in requests. - Enhanced company selection logic in various components to prioritize active company. - Implemented event listeners for company changes to reload data dynamically. - Updated frontend components to handle loading states and errors more effectively. - Ensured all relevant routes and API calls are aligned with the new company context.
This commit is contained in:
@@ -3,24 +3,65 @@ from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class CustomsBrokerDTO(BaseModel):
|
||||
type: Optional[str]
|
||||
class CustomsBrokerBaseDTO(BaseModel):
|
||||
"""Base fields for CustomsBroker"""
|
||||
type: Optional[str] = None
|
||||
name: Optional[str] = None
|
||||
address: Optional[str] = None
|
||||
postal_code: Optional[str] = None
|
||||
city: Optional[str] = None
|
||||
state: Optional[str] = None
|
||||
phone: Optional[str] = None
|
||||
fax: Optional[str] = None
|
||||
email: Optional[str] = None
|
||||
country: Optional[str] = None
|
||||
tax_id: Optional[str] = None
|
||||
personal_id: Optional[str] = None
|
||||
position: Optional[str] = None
|
||||
license: Optional[str] = None
|
||||
company: Optional[str] = None
|
||||
contact: Optional[str] = None
|
||||
|
||||
|
||||
class CustomsBrokerCreateDTO(CustomsBrokerBaseDTO):
|
||||
"""Schema for creating a new CustomsBroker"""
|
||||
broker_key: str
|
||||
name: Optional[str]
|
||||
address: Optional[str]
|
||||
postal_code: Optional[str]
|
||||
city: Optional[str]
|
||||
state: Optional[str]
|
||||
phone: Optional[str]
|
||||
fax: Optional[str]
|
||||
email: Optional[str]
|
||||
country: Optional[str]
|
||||
tax_id: Optional[str]
|
||||
personal_id: Optional[str]
|
||||
position: Optional[str]
|
||||
license: Optional[str]
|
||||
company: Optional[str]
|
||||
contact: Optional[str]
|
||||
|
||||
|
||||
class CustomsBrokerUpdateDTO(CustomsBrokerBaseDTO):
|
||||
"""Schema for updating an existing CustomsBroker"""
|
||||
pass
|
||||
|
||||
|
||||
class CustomsBrokerResponseDTO(CustomsBrokerBaseDTO):
|
||||
"""Schema for CustomsBroker response"""
|
||||
broker_key: str
|
||||
tenant_id: int
|
||||
company_id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# Legacy DTO for backwards compatibility (if needed elsewhere)
|
||||
class CustomsBrokerDTO(BaseModel):
|
||||
type: Optional[str] = None
|
||||
broker_key: str
|
||||
name: Optional[str] = None
|
||||
address: Optional[str] = None
|
||||
postal_code: Optional[str] = None
|
||||
city: Optional[str] = None
|
||||
state: Optional[str] = None
|
||||
phone: Optional[str] = None
|
||||
fax: Optional[str] = None
|
||||
email: Optional[str] = None
|
||||
country: Optional[str] = None
|
||||
tax_id: Optional[str] = None
|
||||
personal_id: Optional[str] = None
|
||||
position: Optional[str] = None
|
||||
license: Optional[str] = None
|
||||
company: Optional[str] = None
|
||||
contact: Optional[str] = None
|
||||
tenant_id: str
|
||||
company_id: str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user