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,23 +3,23 @@ Custom managers and QuerySets for Rides models.
Optimized queries following Django styleguide patterns.
"""
from typing import Optional, List, Union
from django.db.models import Q, F, Count, Prefetch
from django.db.models import Count, F, Prefetch, Q
from apps.core.managers import (
BaseQuerySet,
BaseManager,
ReviewableQuerySet,
BaseQuerySet,
ReviewableManager,
StatusQuerySet,
ReviewableQuerySet,
StatusManager,
StatusQuerySet,
)
class RideQuerySet(StatusQuerySet, ReviewableQuerySet):
"""Optimized QuerySet for Ride model."""
def by_category(self, *, category: Union[str, List[str]]):
def by_category(self, *, category: str | list[str]):
"""Filter rides by category."""
if isinstance(category, list):
return self.filter(category__in=category)
@@ -119,10 +119,10 @@ class RideQuerySet(StatusQuerySet, ReviewableQuerySet):
def search_by_specs(
self,
*,
min_height: Optional[int] = None,
max_height: Optional[int] = None,
min_speed: Optional[float] = None,
inversions: Optional[bool] = None,
min_height: int | None = None,
max_height: int | None = None,
min_speed: float | None = None,
inversions: bool | None = None,
):
"""Search rides by physical specifications."""
queryset = self