Merge pull request 'fixed/clientes_provedores_sellos' (#41) from fixed/clientes_provedores_sellos into feature/creacion_modulo_mercancias
Reviewed-on: ADUANASOFT/anexo76#41
This commit is contained in:
@@ -116,9 +116,7 @@ class ClientProviderCreateDTO(BaseModel):
|
||||
)
|
||||
position: Optional[str] = Field(None, max_length=30, description="Position")
|
||||
incoterm: Optional[str] = Field(None, max_length=19, description="Incoterm")
|
||||
is_national_provider: Optional[str] = Field(
|
||||
None, max_length=2, description="Is national provider"
|
||||
)
|
||||
is_national_provider: Optional[bool] = None
|
||||
is_active: Optional[bool] = Field(None, description="Enabled/Disabled status")
|
||||
|
||||
# Nested DTOs
|
||||
@@ -159,9 +157,7 @@ class ClientProviderUpdateDTO(BaseModel):
|
||||
)
|
||||
position: Optional[str] = Field(None, max_length=30, description="Position")
|
||||
incoterm: Optional[str] = Field(None, max_length=19, description="Incoterm")
|
||||
is_national_provider: Optional[str] = Field(
|
||||
None, max_length=2, description="Is national provider"
|
||||
)
|
||||
is_national_provider: Optional[bool] = None
|
||||
is_active: Optional[bool] = Field(None, description="Enabled/Disabled status")
|
||||
|
||||
# Nested DTOs
|
||||
@@ -193,7 +189,7 @@ class ClientProviderResponseDTO(BaseModel):
|
||||
responsible: Optional[str] = None
|
||||
position: Optional[str] = None
|
||||
incoterm: Optional[str] = None
|
||||
is_national_provider: Optional[str] = None
|
||||
is_national_provider: Optional[bool] = None
|
||||
is_active: Optional[bool] = None
|
||||
tenant_id: int
|
||||
company_id: int
|
||||
|
||||
@@ -61,7 +61,6 @@ async def get_clients_and_providers(
|
||||
"page_size": limit,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/{client_id}/basic", response_model=ClientProviderBasicDTO)
|
||||
async def get_clients_and_providers_basic_info(
|
||||
client_id: int,
|
||||
@@ -111,6 +110,26 @@ async def update_client_provider(
|
||||
|
||||
return client
|
||||
|
||||
@router.get("/{client_id}", response_model=ClientProviderResponseDTO)
|
||||
async def get_client_provider_detail(
|
||||
client_id: int,
|
||||
company_id: int = Query(..., description="Company ID"),
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""
|
||||
Obtener un cliente/proveedor completo por ID.
|
||||
Esta es la ruta que tu formulario necesita para cargar los datos.
|
||||
"""
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
|
||||
# Usamos el servicio para buscar por ID
|
||||
client = ClientProviderService.get_by_id(db, client_id, tenant_id, company_id)
|
||||
|
||||
if not client:
|
||||
raise HTTPException(status_code=404, detail="Client/Provider not found")
|
||||
|
||||
return client
|
||||
|
||||
@router.delete("/{client_id}", response_model=bool)
|
||||
async def delete_client_provider(
|
||||
|
||||
Reference in New Issue
Block a user