# app/modules/orders/routes/admin.py """ Orders module admin routes. This module wraps the existing admin orders routes and adds module-based access control. Routes are re-exported from the original location with the module access dependency. Includes: - /orders/* - Order management - /order-item-exceptions/* - Exception handling """ from fastapi import APIRouter, Depends from app.api.deps import require_module_access # Import original routers (direct import to avoid circular dependency) from app.api.v1.admin.orders import router as orders_original_router from app.api.v1.admin.order_item_exceptions import router as exceptions_original_router # Create module-aware router for orders admin_router = APIRouter( prefix="/orders", dependencies=[Depends(require_module_access("orders"))], ) # Re-export all routes from the original orders module for route in orders_original_router.routes: admin_router.routes.append(route) # Create separate router for order item exceptions # This is included separately in the admin __init__.py admin_exceptions_router = APIRouter( prefix="/order-item-exceptions", dependencies=[Depends(require_module_access("orders"))], ) for route in exceptions_original_router.routes: admin_exceptions_router.routes.append(route)