feat: update Pydantic schemas for unified order model
- Add AddressSnapshot and CustomerSnapshot schemas - Update OrderItemResponse with gtin fields and item_state - Update OrderResponse with all snapshot fields - Add OrderListItem for simplified list views - Add Letzshop-specific schemas (LetzshopOrderImport, LetzshopShippingInfo) - Update AdminOrderItem with new fields 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,9 @@ class LetzshopOrderBase(BaseModel):
|
||||
letzshop_state: str | None = None
|
||||
customer_email: str | None = None
|
||||
customer_name: str | None = None
|
||||
customer_locale: str | None = None
|
||||
shipping_country_iso: str | None = None
|
||||
billing_country_iso: str | None = None
|
||||
total_amount: str | None = None
|
||||
currency: str = "EUR"
|
||||
|
||||
@@ -120,6 +123,7 @@ class LetzshopOrderResponse(LetzshopOrderBase):
|
||||
tracking_number: str | None
|
||||
tracking_carrier: str | None
|
||||
inventory_units: list[dict[str, Any]] | None
|
||||
order_date: datetime | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
@@ -368,3 +372,55 @@ class LetzshopJobsListResponse(BaseModel):
|
||||
|
||||
jobs: list[LetzshopJobItem]
|
||||
total: int
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Historical Import Job Schemas
|
||||
# ============================================================================
|
||||
|
||||
|
||||
class LetzshopHistoricalImportJobResponse(BaseModel):
|
||||
"""Schema for historical import job status (polling endpoint)."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
vendor_id: int
|
||||
status: str # pending, fetching, processing, completed, failed
|
||||
current_phase: str | None = None # "confirmed" or "declined"
|
||||
|
||||
# Fetch progress
|
||||
current_page: int = 0
|
||||
total_pages: int | None = None
|
||||
shipments_fetched: int = 0
|
||||
|
||||
# Processing progress
|
||||
orders_processed: int = 0
|
||||
orders_imported: int = 0
|
||||
orders_updated: int = 0
|
||||
orders_skipped: int = 0
|
||||
|
||||
# EAN matching stats
|
||||
products_matched: int = 0
|
||||
products_not_found: int = 0
|
||||
|
||||
# Phase-specific stats (when complete)
|
||||
confirmed_stats: dict[str, Any] | None = None
|
||||
declined_stats: dict[str, Any] | None = None
|
||||
|
||||
# Error handling
|
||||
error_message: str | None = None
|
||||
|
||||
# Timing
|
||||
started_at: datetime | None = None
|
||||
completed_at: datetime | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class LetzshopHistoricalImportStartResponse(BaseModel):
|
||||
"""Schema for starting a historical import job."""
|
||||
|
||||
job_id: int
|
||||
status: str = "pending"
|
||||
message: str = "Historical import job started"
|
||||
|
||||
Reference in New Issue
Block a user