- Updated SealService to support tenant and company filtering with pagination and enhanced CRUD methods. - Refactored TrailerService to include tenant and company support, added filtering capabilities, and improved CRUD methods. - Introduced TenantCRUDRoutes for Trailer and Transporter routes to streamline API endpoint creation and management. - Enhanced TransporterService with tenant and company filtering, pagination, and improved CRUD operations. - Added Customs Broker module with DTOs, models, services, and routes for managing customs broker data. - Implemented CRUD operations for Customs Broker, including personnel and VU management. - Improved data validation and descriptions in DTOs for better API documentation.
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""
|
|
DTOs for Packages (GBultos).
|
|
"""
|
|
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class PackageBaseDTO(BaseModel):
|
|
key: str = Field(..., description="Package key (primary identifier)", max_length=5)
|
|
description_es: Optional[str] = Field(None, description="Description in Spanish", max_length=40)
|
|
description_en: Optional[str] = Field(None, description="Description in English", max_length=40)
|
|
weight_unit: Optional[float] = Field(None, description="Weight unit")
|
|
plurals: Optional[str] = Field(None, max_length=4)
|
|
plural_in: Optional[str] = Field(None, max_length=4)
|
|
code_ace: Optional[str] = Field(None, max_length=4)
|
|
code_aamex: Optional[str] = Field(None, max_length=9)
|
|
|
|
|
|
class PackageCreateDTO(PackageBaseDTO):
|
|
"""Schema for creating a package"""
|
|
pass
|
|
|
|
|
|
class PackageUpdateDTO(PackageBaseDTO):
|
|
"""Schema for updating a package"""
|
|
key: Optional[str] = Field(None, description="Package key (cannot be modified)", max_length=5)
|
|
|
|
|
|
class PackageResponseDTO(PackageBaseDTO):
|
|
"""Schema for package response"""
|
|
id: int
|
|
company_id: int
|
|
tenant_id: int
|
|
created_at: Optional[str] = None
|
|
updated_at: Optional[str] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|