refactor: migrate schemas to canonical module locations
Migrate remaining legacy schemas to their respective modules: Marketplace module (app/modules/marketplace/schemas/): - letzshop.py: Letzshop credentials, orders, fulfillment, sync - onboarding.py: Vendor onboarding wizard schemas Catalog module (app/modules/catalog/schemas/): - product.py: ProductCreate, ProductUpdate, ProductResponse Payments module (app/modules/payments/schemas/): - payment.py: PaymentConfig, Stripe, transactions, balance Delete legacy files: - models/schema/letzshop.py - models/schema/onboarding.py - models/schema/product.py - models/schema/payment.py - models/schema/marketplace_product.py (re-export) - models/schema/marketplace_import_job.py (re-export) - models/schema/search.py (empty) Update imports across 19 files to use canonical locations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,13 +2,31 @@
|
||||
"""Catalog module schemas."""
|
||||
|
||||
from app.modules.catalog.schemas.catalog import (
|
||||
ProductDetailResponse as CatalogProductDetailResponse,
|
||||
ProductListResponse as CatalogProductListResponse,
|
||||
ProductResponse as CatalogProductResponse,
|
||||
)
|
||||
from app.modules.catalog.schemas.product import (
|
||||
ProductCreate,
|
||||
ProductUpdate,
|
||||
ProductResponse,
|
||||
ProductDetailResponse,
|
||||
ProductListResponse,
|
||||
ProductResponse,
|
||||
ProductDeleteResponse,
|
||||
ProductToggleResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Catalog browsing schemas (storefront)
|
||||
"CatalogProductResponse",
|
||||
"CatalogProductDetailResponse",
|
||||
"CatalogProductListResponse",
|
||||
# Product CRUD schemas (vendor management)
|
||||
"ProductCreate",
|
||||
"ProductUpdate",
|
||||
"ProductResponse",
|
||||
"ProductDetailResponse",
|
||||
"ProductListResponse",
|
||||
"ProductDeleteResponse",
|
||||
"ProductToggleResponse",
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@ from datetime import datetime
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||
from models.schema.marketplace_product import MarketplaceProductResponse
|
||||
from app.modules.marketplace.schemas import MarketplaceProductResponse
|
||||
|
||||
|
||||
class ProductResponse(BaseModel):
|
||||
|
||||
94
app/modules/catalog/schemas/product.py
Normal file
94
app/modules/catalog/schemas/product.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# app/modules/catalog/schemas/product.py
|
||||
"""
|
||||
Pydantic schemas for Product CRUD operations.
|
||||
|
||||
These schemas are used for vendor product catalog management,
|
||||
linking vendor products to marketplace products.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||
from app.modules.marketplace.schemas import MarketplaceProductResponse
|
||||
|
||||
|
||||
class ProductCreate(BaseModel):
|
||||
marketplace_product_id: int = Field(
|
||||
..., description="MarketplaceProduct ID to add to vendor catalog"
|
||||
)
|
||||
vendor_sku: str | None = Field(None, description="Vendor's internal SKU")
|
||||
price: float | None = Field(None, ge=0)
|
||||
sale_price: float | None = Field(None, ge=0)
|
||||
currency: str | None = None
|
||||
availability: str | None = None
|
||||
condition: str | None = None
|
||||
is_featured: bool = False
|
||||
min_quantity: int = Field(1, ge=1)
|
||||
max_quantity: int | None = Field(None, ge=1)
|
||||
|
||||
|
||||
class ProductUpdate(BaseModel):
|
||||
vendor_sku: str | None = None
|
||||
price: float | None = Field(None, ge=0)
|
||||
sale_price: float | None = Field(None, ge=0)
|
||||
currency: str | None = None
|
||||
availability: str | None = None
|
||||
condition: str | None = None
|
||||
is_featured: bool | None = None
|
||||
is_active: bool | None = None
|
||||
min_quantity: int | None = Field(None, ge=1)
|
||||
max_quantity: int | None = Field(None, ge=1)
|
||||
|
||||
|
||||
class ProductResponse(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
vendor_id: int
|
||||
marketplace_product: MarketplaceProductResponse
|
||||
vendor_sku: str | None
|
||||
price: float | None
|
||||
sale_price: float | None
|
||||
currency: str | None
|
||||
availability: str | None
|
||||
condition: str | None
|
||||
is_featured: bool
|
||||
is_active: bool
|
||||
display_order: int
|
||||
min_quantity: int
|
||||
max_quantity: int | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
# Include inventory summary
|
||||
total_inventory: int | None = None
|
||||
available_inventory: int | None = None
|
||||
|
||||
|
||||
class ProductDetailResponse(ProductResponse):
|
||||
"""Product with full inventory details."""
|
||||
|
||||
inventory_locations: list[InventoryLocationResponse] = []
|
||||
|
||||
|
||||
class ProductListResponse(BaseModel):
|
||||
products: list[ProductResponse]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
|
||||
class ProductDeleteResponse(BaseModel):
|
||||
"""Response for product deletion."""
|
||||
|
||||
message: str
|
||||
|
||||
|
||||
class ProductToggleResponse(BaseModel):
|
||||
"""Response for product toggle operations (active/featured)."""
|
||||
|
||||
message: str
|
||||
is_active: bool | None = None
|
||||
is_featured: bool | None = None
|
||||
Reference in New Issue
Block a user