mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-30 08:27:00 -05:00
feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
from rest_framework.permissions import AllowAny
|
||||
from django.db.models import F
|
||||
|
||||
from django.utils import timezone
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from datetime import timedelta
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from apps.parks.models import Park
|
||||
from apps.rides.models import Ride
|
||||
|
||||
|
||||
class DiscoveryAPIView(APIView):
|
||||
"""
|
||||
API endpoint for discovery content (Top Lists, Opening/Closing Soon).
|
||||
@@ -28,7 +28,7 @@ class DiscoveryAPIView(APIView):
|
||||
# --- TOP LISTS ---
|
||||
# Top Parks by average rating
|
||||
top_parks = Park.objects.filter(average_rating__isnull=False).order_by("-average_rating")[:limit]
|
||||
|
||||
|
||||
# Top Rides by average rating (fallback to RideRanking in future)
|
||||
top_rides = Ride.objects.filter(average_rating__isnull=False).order_by("-average_rating")[:limit]
|
||||
|
||||
@@ -70,7 +70,7 @@ class DiscoveryAPIView(APIView):
|
||||
"rides": self._serialize(recently_closed_rides, "ride"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Response(data)
|
||||
|
||||
def _serialize(self, queryset, type_):
|
||||
|
||||
Reference in New Issue
Block a user