feat: complete analytics module self-containment
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>
This commit is contained in:
@@ -6,8 +6,9 @@ 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 vendor.py as needed:
|
||||
from app.modules.analytics.routes.vendor import vendor_router
|
||||
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.
|
||||
"""
|
||||
@@ -15,12 +16,15 @@ 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_router"]
|
||||
__all__ = ["vendor_api_router", "vendor_page_router"]
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
"""Lazy import routers to avoid circular dependencies."""
|
||||
if name == "vendor_router":
|
||||
from app.modules.analytics.routes.vendor import vendor_router
|
||||
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}")
|
||||
|
||||
Reference in New Issue
Block a user