feat: Implement initial schema and add various API, service, and management command enhancements across the application.

This commit is contained in:
pacnpal
2026-01-01 15:13:01 -05:00
parent c95f99ca10
commit b243b17af7
413 changed files with 11164 additions and 17433 deletions

View File

@@ -186,21 +186,13 @@ class StatsAPIView(APIView):
total_rides = Ride.objects.count()
# Company counts by role
total_manufacturers = RideCompany.objects.filter(
roles__contains=["MANUFACTURER"]
).count()
total_manufacturers = RideCompany.objects.filter(roles__contains=["MANUFACTURER"]).count()
total_operators = ParkCompany.objects.filter(
roles__contains=["OPERATOR"]
).count()
total_operators = ParkCompany.objects.filter(roles__contains=["OPERATOR"]).count()
total_designers = RideCompany.objects.filter(
roles__contains=["DESIGNER"]
).count()
total_designers = RideCompany.objects.filter(roles__contains=["DESIGNER"]).count()
total_property_owners = ParkCompany.objects.filter(
roles__contains=["PROPERTY_OWNER"]
).count()
total_property_owners = ParkCompany.objects.filter(roles__contains=["PROPERTY_OWNER"]).count()
# Photo counts (combined)
total_park_photos = ParkPhoto.objects.count()
@@ -211,11 +203,7 @@ class StatsAPIView(APIView):
total_roller_coasters = RollerCoasterStats.objects.count()
# Ride category counts
ride_categories = (
Ride.objects.values("category")
.annotate(count=Count("id"))
.exclude(category="")
)
ride_categories = Ride.objects.values("category").annotate(count=Count("id")).exclude(category="")
category_stats = {}
for category in ride_categories:
@@ -232,9 +220,7 @@ class StatsAPIView(APIView):
"OT": "other_rides",
}
category_name = category_names.get(
category_code, f"category_{category_code.lower()}"
)
category_name = category_names.get(category_code, f"category_{category_code.lower()}")
category_stats[category_name] = category_count
# Park status counts
@@ -281,9 +267,7 @@ class StatsAPIView(APIView):
"RELOCATED": "relocated_rides",
}
status_name = status_names.get(
status_code, f"ride_status_{status_code.lower()}"
)
status_name = status_names.get(status_code, f"ride_status_{status_code.lower()}")
ride_status_stats[status_name] = status_count
# Review counts
@@ -365,7 +349,7 @@ class StatsRecalculateAPIView(APIView):
# Return success response with the fresh stats
return Response(
{
"message": "Platform statistics have been successfully recalculated",
"detail": "Platform statistics have been successfully recalculated",
"stats": fresh_stats,
"recalculated_at": timezone.now().isoformat(),
},