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

@@ -143,11 +143,7 @@ class RideMediaService:
Returns:
List of RidePhoto instances
"""
return list(
ride.photos.filter(photo_type=photo_type, is_approved=True).order_by(
"-created_at"
)
)
return list(ride.photos.filter(photo_type=photo_type, is_approved=True).order_by("-created_at"))
@staticmethod
def set_primary_photo(ride: Ride, photo: RidePhoto) -> bool:
@@ -218,9 +214,7 @@ class RideMediaService:
photo.image.delete(save=False)
photo.delete()
logger.info(
f"Photo {photo_id} deleted from ride {ride_slug} by user {deleted_by.username}"
)
logger.info(f"Photo {photo_id} deleted from ride {ride_slug} by user {deleted_by.username}")
return True
except Exception as e:
logger.error(f"Failed to delete photo {photo.pk}: {str(e)}")
@@ -272,9 +266,7 @@ class RideMediaService:
if RideMediaService.approve_photo(photo, approved_by):
approved_count += 1
logger.info(
f"Bulk approved {approved_count} photos by user {approved_by.username}"
)
logger.info(f"Bulk approved {approved_count} photos by user {approved_by.username}")
return approved_count
@staticmethod
@@ -289,9 +281,7 @@ class RideMediaService:
List of construction RidePhoto instances ordered by date taken
"""
return list(
ride.photos.filter(photo_type="construction", is_approved=True).order_by(
"date_taken", "created_at"
)
ride.photos.filter(photo_type="construction", is_approved=True).order_by("date_taken", "created_at")
)
@staticmethod