feat: Implement MFA authentication, add ride statistics model, and update various services, APIs, and tests across the application.

This commit is contained in:
pacnpal
2025-12-28 17:32:53 -05:00
parent aa56c46c27
commit c95f99ca10
452 changed files with 7948 additions and 6073 deletions

View File

@@ -3,17 +3,18 @@ Selectors for ride-related data retrieval.
Following Django styleguide pattern for separating data access from business logic.
"""
from typing import Optional, Dict, Any
from django.db.models import QuerySet, Q, Count, Avg, Prefetch
from typing import Any
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import Distance
from django.db.models import Avg, Count, Prefetch, Q, QuerySet
from .models import Ride, RideModel, RideReview
from .choices import RIDE_CATEGORIES
from .models import Ride, RideModel, RideReview
def ride_list_for_display(
*, filters: Optional[Dict[str, Any]] = None
*, filters: dict[str, Any] | None = None
) -> QuerySet[Ride]:
"""
Get rides optimized for list display with related data.
@@ -246,9 +247,10 @@ def rides_with_recent_reviews(*, days: int = 30) -> QuerySet[Ride]:
Returns:
QuerySet of rides with recent reviews
"""
from django.utils import timezone
from datetime import timedelta
from django.utils import timezone
cutoff_date = timezone.now() - timedelta(days=days)
return (
@@ -267,7 +269,7 @@ def rides_with_recent_reviews(*, days: int = 30) -> QuerySet[Ride]:
)
def ride_statistics_by_category() -> Dict[str, Any]:
def ride_statistics_by_category() -> dict[str, Any]:
"""
Get ride statistics grouped by category.