Migrate analytics module to fully self-contained structure: - routes/api/vendor.py - API endpoints - routes/pages/vendor.py - Page routes with full implementation - services/stats_service.py - Business logic (moved from app/services) - services/usage_service.py - Usage tracking (moved from app/services) - schemas/stats.py - Pydantic schemas (moved from models/schema) - models/__init__.py - Model exports - templates/analytics/vendor/ - Templates (moved from app/templates) - static/vendor/js/ - JavaScript (moved from static/vendor) - locales/ - Translations (en, de, fr, lu) - exceptions.py - Module exceptions Removed legacy files: - app/modules/analytics/routes/vendor.py (replaced by routes/pages/) - static/admin/js/analytics.js (unused) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# app/modules/analytics/routes/__init__.py
|
|
"""
|
|
Analytics module route registration.
|
|
|
|
This module provides functions to register analytics routes
|
|
with module-based access control.
|
|
|
|
NOTE: Routers are NOT auto-imported to avoid circular dependencies.
|
|
Import directly from api/ or pages/ as needed:
|
|
from app.modules.analytics.routes.api import vendor_router as vendor_api_router
|
|
from app.modules.analytics.routes.pages import vendor_router as vendor_page_router
|
|
|
|
Note: Analytics module has no admin routes - admin uses dashboard.
|
|
"""
|
|
|
|
# Routers are imported on-demand to avoid circular dependencies
|
|
# Do NOT add auto-imports here
|
|
|
|
__all__ = ["vendor_api_router", "vendor_page_router"]
|
|
|
|
|
|
def __getattr__(name: str):
|
|
"""Lazy import routers to avoid circular dependencies."""
|
|
if name == "vendor_api_router":
|
|
from app.modules.analytics.routes.api import vendor_router
|
|
return vendor_router
|
|
elif name == "vendor_page_router":
|
|
from app.modules.analytics.routes.pages import vendor_router
|
|
return vendor_router
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|