feat(modules): create cart, catalog, and checkout e-commerce modules
Phase 3 of storefront restructure plan - create dedicated modules for e-commerce functionality: - cart: Shopping cart management with storefront API routes - CartItem model with cents-based pricing - CartService for cart operations - Storefront routes for cart CRUD operations - catalog: Product catalog browsing for customers - CatalogService for public product queries - Storefront routes for product listing/search/details - checkout: Order creation from cart (placeholder) - CheckoutService stub for future cart-to-order conversion - Schemas for checkout flow These modules separate e-commerce concerns from core platform concerns (customer auth), enabling non-commerce platforms. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
56
app/modules/catalog/schemas/catalog.py
Normal file
56
app/modules/catalog/schemas/catalog.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# app/modules/catalog/schemas/catalog.py
|
||||
"""
|
||||
Pydantic schemas for catalog browsing operations.
|
||||
|
||||
These schemas are for the public storefront catalog API.
|
||||
For vendor product management, see the products module.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from models.schema.inventory import InventoryLocationResponse
|
||||
from models.schema.marketplace_product import MarketplaceProductResponse
|
||||
|
||||
|
||||
class ProductResponse(BaseModel):
|
||||
"""Response model for a product in the catalog."""
|
||||
|
||||
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):
|
||||
"""Paginated list of products."""
|
||||
|
||||
products: list[ProductResponse]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
Reference in New Issue
Block a user