feat: extract inventory, orders, and marketplace modules (Phase 4)
Extract three additional modules following the billing module pattern: Inventory Module (app/modules/inventory/): - Stock management and tracking - Inventory locations - Low stock alerts - Admin and vendor routes with module access control Orders Module (app/modules/orders/): - Order management and fulfillment - Order item exceptions - Bulk operations and export - Admin and vendor routes with module access control Marketplace Module (app/modules/marketplace/): - Letzshop integration - Product sync - Marketplace import - Depends on inventory module - Admin and vendor routes with module access control Admin router updated: - Uses module routers with require_module_access dependency - Legacy router includes commented out - Routes verified: 15 inventory, 16 orders, 42 marketplace All 31 module tests passing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,12 +27,15 @@ based on platform context (not at route registration time).
|
||||
|
||||
Extracted modules (app/modules/{module}/routes/):
|
||||
- billing: Subscription tiers, vendor billing, invoices
|
||||
- inventory: Stock management, inventory tracking
|
||||
- orders: Order management, fulfillment, exceptions
|
||||
- marketplace: Letzshop integration, product sync
|
||||
|
||||
Future extractions will follow the same pattern:
|
||||
Module extraction pattern:
|
||||
1. Create app/modules/{module}/ directory
|
||||
2. Move routes to app/modules/{module}/routes/admin.py
|
||||
3. Add require_module_access("{module}") to router
|
||||
4. Update this file to import from module instead
|
||||
2. Create routes/admin.py with require_module_access("{module}") dependency
|
||||
3. Import module router here and include it
|
||||
4. Comment out legacy router include
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
@@ -77,6 +80,11 @@ from . import (
|
||||
|
||||
# Import extracted module routers
|
||||
from app.modules.billing.routes import admin_router as billing_admin_router
|
||||
from app.modules.inventory.routes import admin_router as inventory_admin_router
|
||||
from app.modules.orders.routes.admin import admin_router as orders_admin_router
|
||||
from app.modules.orders.routes.admin import admin_exceptions_router as orders_exceptions_router
|
||||
from app.modules.marketplace.routes.admin import admin_router as marketplace_admin_router
|
||||
from app.modules.marketplace.routes.admin import admin_letzshop_router as letzshop_admin_router
|
||||
|
||||
# Create admin router
|
||||
router = APIRouter()
|
||||
@@ -141,7 +149,7 @@ router.include_router(dashboard.router, tags=["admin-dashboard"])
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Vendor Operations (Product Catalog, Inventory & Orders)
|
||||
# Vendor Operations (Product Catalog, Inventory & Orders) - Module-gated
|
||||
# ============================================================================
|
||||
|
||||
# Include marketplace product catalog management endpoints
|
||||
@@ -150,27 +158,26 @@ router.include_router(products.router, tags=["admin-marketplace-products"])
|
||||
# Include vendor product catalog management endpoints
|
||||
router.include_router(vendor_products.router, tags=["admin-vendor-products"])
|
||||
|
||||
# Include inventory management endpoints
|
||||
router.include_router(inventory.router, tags=["admin-inventory"])
|
||||
# Include inventory module router (with module access control)
|
||||
router.include_router(inventory_admin_router, tags=["admin-inventory"])
|
||||
# Legacy: router.include_router(inventory.router, tags=["admin-inventory"])
|
||||
|
||||
# Include order management endpoints
|
||||
router.include_router(orders.router, tags=["admin-orders"])
|
||||
|
||||
# Include order item exception management endpoints
|
||||
router.include_router(
|
||||
order_item_exceptions.router, tags=["admin-order-exceptions"]
|
||||
)
|
||||
# Include orders module router (with module access control)
|
||||
router.include_router(orders_admin_router, tags=["admin-orders"])
|
||||
router.include_router(orders_exceptions_router, tags=["admin-order-exceptions"])
|
||||
# Legacy: router.include_router(orders.router, tags=["admin-orders"])
|
||||
# Legacy: router.include_router(order_item_exceptions.router, tags=["admin-order-exceptions"])
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Marketplace & Imports
|
||||
# Marketplace & Imports (Module-gated)
|
||||
# ============================================================================
|
||||
|
||||
# Include marketplace monitoring endpoints
|
||||
router.include_router(marketplace.router, tags=["admin-marketplace"])
|
||||
|
||||
# Include Letzshop integration endpoints
|
||||
router.include_router(letzshop.router, tags=["admin-letzshop"])
|
||||
# Include marketplace module router (with module access control)
|
||||
router.include_router(marketplace_admin_router, tags=["admin-marketplace"])
|
||||
router.include_router(letzshop_admin_router, tags=["admin-letzshop"])
|
||||
# Legacy: router.include_router(marketplace.router, tags=["admin-marketplace"])
|
||||
# Legacy: router.include_router(letzshop.router, tags=["admin-letzshop"])
|
||||
|
||||
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user