Phase 5 of storefront restructure plan - fix direct model imports in API routes by using schemas for dependency injection. Created CustomerContext schema: - Lightweight Pydantic model for customer data in API routes - Populated from Customer DB model in auth dependency - Contains all fields needed by storefront routes - Includes from_db_model() factory method Updated app/api/deps.py: - _validate_customer_token now returns CustomerContext instead of Customer - Updated docstrings for all customer auth functions Updated module storefront routes: - customers: Uses CustomerContext for profile/address endpoints - orders: Uses CustomerContext for order history endpoints - checkout: Uses CustomerContext for order placement - messaging: Uses CustomerContext for messaging endpoints This enforces the layered architecture (Routes → Services → Models) by ensuring API routes never import database models directly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 KiB
44 KiB