Files
thrillwiki_django_no_react/backend/apps/api/v1/viewsets.py
pacnpal 540f40e689 Revert "update"
This reverts commit 75cc618c2b.
2025-09-21 20:11:00 -04:00

65 lines
1.8 KiB
Python

"""
Consolidated ViewSets for ThrillWiki API v1.
This module contains ViewSets that are shared across domains or don't fit
into specific domain modules. Domain-specific ViewSets have been moved to:
- Parks: api/v1/parks/views.py
- Rides: api/v1/rides/views.py
- Accounts: api/v1/accounts/views.py
- History: api/v1/history/views.py
- Auth/Health/Trending: api/v1/views/
"""
# This file is intentionally minimal now that ViewSets have been distributed
# to domain-specific modules. Only shared utilities and fallback classes remain.
# Handle optional dependencies with fallback classes
class FallbackTurnstileMixin:
"""Fallback mixin if TurnstileMixin is not available."""
def validate_turnstile(self, request):
pass
class FallbackCacheMonitor:
"""Fallback class if CacheMonitor is not available."""
def get_cache_stats(self):
return {"error": "Cache monitoring not available"}
class FallbackIndexAnalyzer:
"""Fallback class if IndexAnalyzer is not available."""
@staticmethod
def analyze_slow_queries(threshold):
return {"error": "Query analysis not available"}
# Try to import the real classes, use fallbacks if not available
try:
from apps.accounts.mixins import TurnstileMixin
except ImportError:
TurnstileMixin = FallbackTurnstileMixin
try:
from apps.core.services.enhanced_cache_service import CacheMonitor
except ImportError:
CacheMonitor = FallbackCacheMonitor
try:
from apps.core.utils.query_optimization import IndexAnalyzer
except ImportError:
IndexAnalyzer = FallbackIndexAnalyzer
# Export fallback classes for use in domain-specific modules
__all__ = [
"TurnstileMixin",
"CacheMonitor",
"IndexAnalyzer",
"FallbackTurnstileMixin",
"FallbackCacheMonitor",
"FallbackIndexAnalyzer",
]