feat: complete monorepo structure with frontend and shared resources

- Add complete backend/ directory with full Django application
- Add frontend/ directory with Vite + TypeScript setup ready for Next.js
- Add comprehensive shared/ directory with:
  - Complete documentation and memory-bank archives
  - Media files and avatars (letters, park/ride images)
  - Deployment scripts and automation tools
  - Shared types and utilities
- Add architecture/ directory with migration guides
- Configure pnpm workspace for monorepo development
- Update .gitignore to exclude .django_tailwind_cli/ build artifacts
- Preserve all historical documentation in shared/docs/memory-bank/
- Set up proper structure for full-stack development with shared resources
This commit is contained in:
pacnpal
2025-08-23 18:40:07 -04:00
parent b0e0678590
commit d504d41de2
762 changed files with 142636 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
import requests
from django.core.management.base import BaseCommand
from apps.media.models import Photo
from apps.parks.models import Park
from apps.rides.models import Ride
from django.contrib.contenttypes.models import ContentType
import json
from django.core.files.base import ContentFile
class Command(BaseCommand):
help = "Download photos from seed data URLs"
def handle(self, *args, **kwargs):
self.stdout.write("Downloading photos from seed data...")
# Read seed data
with open("parks/management/commands/seed_data.json", "r") as f:
seed_data = json.load(f)
park_content_type = ContentType.objects.get_for_model(Park)
ride_content_type = ContentType.objects.get_for_model(Ride)
# Process parks and their photos
for park_data in seed_data["parks"]:
try:
park = Park.objects.get(name=park_data["name"])
# Download park photos
for idx, photo_url in enumerate(park_data["photos"], 1):
try:
# Download image
self.stdout.write(f"Downloading from URL: {photo_url}")
response = requests.get(photo_url, timeout=60)
if response.status_code == 200:
# Delete any existing photos for this park
Photo.objects.filter(
content_type=park_content_type,
object_id=park.id,
).delete()
# Create new photo record
photo = Photo(
content_type=park_content_type,
object_id=park.id,
is_primary=idx == 1,
)
# Save image content
photo.image.save(
f"{park.slug}_{idx}.jpg",
ContentFile(response.content),
save=False,
)
photo.save()
self.stdout.write(
f"Downloaded photo for {
park.name}: {
photo.image.name}"
)
self.stdout.write(
f"Database record created with ID: {photo.id}"
)
else:
self.stdout.write(
f"Error downloading image. Status code: {
response.status_code}"
)
except Exception as e:
self.stdout.write(
f"Error downloading park photo: {
str(e)}"
)
# Process rides and their photos
for ride_data in park_data["rides"]:
try:
ride = Ride.objects.get(name=ride_data["name"], park=park)
# Download ride photos
for idx, photo_url in enumerate(ride_data["photos"], 1):
try:
# Download image
self.stdout.write(f"Downloading from URL: {photo_url}")
response = requests.get(photo_url, timeout=60)
if response.status_code == 200:
# Delete any existing photos for this ride
Photo.objects.filter(
content_type=ride_content_type,
object_id=ride.id,
).delete()
# Create new photo record
photo = Photo(
content_type=ride_content_type,
object_id=ride.id,
is_primary=idx == 1,
)
# Save image content
photo.image.save(
f"{ride.slug}_{idx}.jpg",
ContentFile(response.content),
save=False,
)
photo.save()
self.stdout.write(
f"Downloaded photo for {
ride.name}: {
photo.image.name}"
)
self.stdout.write(
f"Database record created with ID: {
photo.id}"
)
else:
self.stdout.write(
f"Error downloading image. Status code: {
response.status_code}"
)
except Exception as e:
self.stdout.write(
f"Error downloading ride photo: {str(e)}"
)
except Ride.DoesNotExist:
self.stdout.write(
f'Ride not found: {
ride_data["name"]}'
)
except Park.DoesNotExist:
self.stdout.write(f'Park not found: {park_data["name"]}')
self.stdout.write("Finished downloading photos")