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

@@ -52,9 +52,7 @@ class Command(BaseCommand):
park.name}: {
photo.image.name}"
)
self.stdout.write(
f"Database record created with ID: {photo.id}"
)
self.stdout.write(f"Database record created with ID: {photo.id}")
else:
self.stdout.write(
f"Error downloading image. Status code: {
@@ -112,9 +110,7 @@ class Command(BaseCommand):
)
except Exception as e:
self.stdout.write(
f"Error downloading ride photo: {str(e)}"
)
self.stdout.write(f"Error downloading ride photo: {str(e)}")
except Ride.DoesNotExist:
self.stdout.write(

View File

@@ -49,9 +49,7 @@ class Command(BaseCommand):
if files:
# Get the first file and update the database
# record
file_path = os.path.join(
content_type, identifier, files[0]
)
file_path = os.path.join(content_type, identifier, files[0])
if os.path.exists(os.path.join("media", file_path)):
photo.image.name = file_path
photo.save()
@@ -111,9 +109,7 @@ class Command(BaseCommand):
if files:
# Get the first file and update the database
# record
file_path = os.path.join(
content_type, identifier, files[0]
)
file_path = os.path.join(content_type, identifier, files[0])
if os.path.exists(os.path.join("media", file_path)):
photo.image.name = file_path
photo.save()

View File

@@ -37,9 +37,7 @@ class Command(BaseCommand):
identifier = photo.park.slug
# Look for any files in that directory
old_dir = os.path.join(
settings.MEDIA_ROOT, content_type, identifier
)
old_dir = os.path.join(settings.MEDIA_ROOT, content_type, identifier)
if os.path.exists(old_dir):
files = [
f
@@ -83,9 +81,7 @@ class Command(BaseCommand):
# Move the file
if current_path != new_full_path:
shutil.copy2(
current_path, new_full_path
) # Use copy2 to preserve metadata
shutil.copy2(current_path, new_full_path) # Use copy2 to preserve metadata
processed_files.add(current_path)
else:
processed_files.add(current_path)
@@ -116,9 +112,7 @@ class Command(BaseCommand):
identifier = parts[1] # e.g., 'alton-towers'
# Look for any files in that directory
old_dir = os.path.join(
settings.MEDIA_ROOT, content_type, identifier
)
old_dir = os.path.join(settings.MEDIA_ROOT, content_type, identifier)
if os.path.exists(old_dir):
files = [
f
@@ -162,9 +156,7 @@ class Command(BaseCommand):
# Move the file
if current_path != new_full_path:
shutil.copy2(
current_path, new_full_path
) # Use copy2 to preserve metadata
shutil.copy2(current_path, new_full_path) # Use copy2 to preserve metadata
processed_files.add(current_path)
else:
processed_files.add(current_path)
@@ -192,8 +184,6 @@ class Command(BaseCommand):
os.remove(file_path)
self.stdout.write(f"Removed old file: {file_path}")
except Exception as e:
self.stdout.write(
f"Error removing {file_path}: {str(e)}"
)
self.stdout.write(f"Error removing {file_path}: {str(e)}")
self.stdout.write("Finished moving photo files and cleaning up")