mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:11:09 -05:00
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:
320
backend/apps/parks/management/commands/create_sample_data.py
Normal file
320
backend/apps/parks/management/commands/create_sample_data.py
Normal file
@@ -0,0 +1,320 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
|
||||
# Import models from both apps
|
||||
from apps.parks.models import Company as ParkCompany
|
||||
from apps.rides.models.company import Company as RideCompany
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Creates comprehensive sample data for the ThrillWiki theme park application"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.created_companies = {}
|
||||
self.created_parks = {}
|
||||
self.created_rides = {}
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write("Starting sample data creation...")
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
self.create_companies()
|
||||
self.create_parks()
|
||||
self.create_ride_models()
|
||||
self.create_rides()
|
||||
self.create_park_areas()
|
||||
self.create_reviews()
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS("Successfully created comprehensive sample data!")
|
||||
)
|
||||
self.print_summary()
|
||||
|
||||
except Exception as e:
|
||||
self.stdout.write(self.style.ERROR(f"Error creating sample data: {e}"))
|
||||
raise
|
||||
|
||||
def create_companies(self):
|
||||
"""Create companies with different roles following entity relationship rules"""
|
||||
self.stdout.write("Creating companies...")
|
||||
|
||||
# Park operators and property owners (using parks.models.Company)
|
||||
park_operators_data = [
|
||||
{
|
||||
"name": "The Walt Disney Company",
|
||||
"slug": "walt-disney-company",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "World's largest entertainment company and theme park operator.",
|
||||
"website": "https://www.disney.com/",
|
||||
"founded_year": 1923,
|
||||
},
|
||||
{
|
||||
"name": "Universal Parks & Resorts",
|
||||
"slug": "universal-parks-resorts",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "Division of Comcast NBCUniversal, operating major theme parks worldwide.",
|
||||
"website": "https://www.universalparks.com/",
|
||||
"founded_year": 1964,
|
||||
},
|
||||
{
|
||||
"name": "Six Flags Entertainment Corporation",
|
||||
"slug": "six-flags-entertainment",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "World's largest regional theme park company.",
|
||||
"website": "https://www.sixflags.com/",
|
||||
"founded_year": 1961,
|
||||
},
|
||||
{
|
||||
"name": "Cedar Fair Entertainment Company",
|
||||
"slug": "cedar-fair-entertainment",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "One of North America's largest operators of regional amusement parks.",
|
||||
"website": "https://www.cedarfair.com/",
|
||||
"founded_year": 1983,
|
||||
},
|
||||
{
|
||||
"name": "Herschend Family Entertainment",
|
||||
"slug": "herschend-family-entertainment",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "Largest family-owned themed attractions corporation in the United States.",
|
||||
"website": "https://www.hfecorp.com/",
|
||||
"founded_year": 1950,
|
||||
},
|
||||
{
|
||||
"name": "SeaWorld Parks & Entertainment",
|
||||
"slug": "seaworld-parks-entertainment",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "Theme park and entertainment company focusing on nature-based themes.",
|
||||
"website": "https://www.seaworldentertainment.com/",
|
||||
"founded_year": 1959,
|
||||
},
|
||||
{
|
||||
"name": "Merlin Entertainments",
|
||||
"slug": "merlin-entertainments",
|
||||
"roles": ["OPERATOR", "PROPERTY_OWNER"],
|
||||
"description": "European theme park operator with LEGOLAND and Madame Tussauds brands.",
|
||||
"website": "https://www.merlinentertainments.com/",
|
||||
"founded_year": 1998,
|
||||
},
|
||||
]
|
||||
|
||||
for company_data in park_operators_data:
|
||||
company, created = ParkCompany.objects.get_or_create(
|
||||
slug=company_data["slug"], defaults=company_data
|
||||
)
|
||||
self.created_companies[company.slug] = company
|
||||
self.stdout.write(
|
||||
f' {
|
||||
"Created" if created else "Found"} park company: {
|
||||
company.name}'
|
||||
)
|
||||
|
||||
# Ride manufacturers and designers (using rides.models.Company)
|
||||
ride_companies_data = [
|
||||
{
|
||||
"name": "Bolliger & Mabillard",
|
||||
"slug": "bolliger-mabillard",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "Swiss roller coaster manufacturer known for inverted and diving coasters.",
|
||||
"website": "https://www.bolliger-mabillard.com/",
|
||||
"founded_date": "1988-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Intamin Amusement Rides",
|
||||
"slug": "intamin-amusement-rides",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "Liechtenstein-based manufacturer of roller coasters and thrill rides.",
|
||||
"website": "https://www.intamin.com/",
|
||||
"founded_date": "1967-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Arrow Dynamics",
|
||||
"slug": "arrow-dynamics",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "American manufacturer known for corkscrew coasters and mine trains.",
|
||||
"website": "https://en.wikipedia.org/wiki/Arrow_Dynamics",
|
||||
"founded_date": "1946-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Vekoma Rides Manufacturing",
|
||||
"slug": "vekoma-rides-manufacturing",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "Dutch manufacturer of roller coasters and family rides.",
|
||||
"website": "https://www.vekoma.com/",
|
||||
"founded_date": "1926-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Rocky Mountain Construction",
|
||||
"slug": "rocky-mountain-construction",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "American manufacturer specializing in I-Box track and Raptor track coasters.",
|
||||
"website": "https://www.rockymtnconstruction.com/",
|
||||
"founded_date": "2001-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Mack Rides",
|
||||
"slug": "mack-rides",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "German manufacturer known for water rides and powered coasters.",
|
||||
"website": "https://www.mack-rides.com/",
|
||||
"founded_date": "1780-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Chance Rides",
|
||||
"slug": "chance-rides",
|
||||
"roles": ["MANUFACTURER"],
|
||||
"description": "American manufacturer of thrill rides and amusement park equipment.",
|
||||
"website": "https://www.chancerides.com/",
|
||||
"founded_date": "1961-01-01",
|
||||
},
|
||||
{
|
||||
"name": "S&S Worldwide",
|
||||
"slug": "s-s-worldwide",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "American manufacturer known for drop towers and 4D free-fly coasters.",
|
||||
"website": "https://www.s-s.com/",
|
||||
"founded_date": "1990-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Zierer Rides",
|
||||
"slug": "zierer-rides",
|
||||
"roles": ["MANUFACTURER"],
|
||||
"description": "German manufacturer of kiddie rides and family coasters.",
|
||||
"website": "https://www.zierer.com/",
|
||||
"founded_date": "1950-01-01",
|
||||
},
|
||||
{
|
||||
"name": "Gerstlauer",
|
||||
"slug": "gerstlauer",
|
||||
"roles": ["MANUFACTURER", "DESIGNER"],
|
||||
"description": "German manufacturer known for Euro-Fighter and spinning coasters.",
|
||||
"website": "https://www.gerstlauer-rides.de/",
|
||||
"founded_date": "1982-01-01",
|
||||
},
|
||||
]
|
||||
|
||||
for company_data in ride_companies_data:
|
||||
company, created = RideCompany.objects.get_or_create(
|
||||
slug=company_data["slug"], defaults=company_data
|
||||
)
|
||||
self.created_companies[company.slug] = company
|
||||
self.stdout.write(
|
||||
f' {
|
||||
"Created" if created else "Found"} ride company: {
|
||||
company.name}'
|
||||
)
|
||||
|
||||
def create_parks(self):
|
||||
"""Create parks with proper operator relationships"""
|
||||
self.stdout.write("Creating parks...")
|
||||
|
||||
# TODO: Implement park creation - parks_data defined but not used yet
|
||||
parks_data = [ # noqa: F841
|
||||
{
|
||||
"name": "Magic Kingdom",
|
||||
"slug": "magic-kingdom",
|
||||
"operator_slug": "walt-disney-company",
|
||||
"property_owner_slug": "walt-disney-company",
|
||||
"description": "The first theme park at Walt Disney World Resort in Florida, opened in 1971.",
|
||||
"opening_date": "1971-10-01",
|
||||
"size_acres": 142,
|
||||
"website": "https://disneyworld.disney.go.com/destinations/magic-kingdom/",
|
||||
"location": {
|
||||
"street_address": "1180 Seven Seas Dr",
|
||||
"city": "Lake Buena Vista",
|
||||
"state_province": "Florida",
|
||||
"country": "USA",
|
||||
"postal_code": "32830",
|
||||
"latitude": 28.4177,
|
||||
"longitude": -81.5812,
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Universal Studios Florida",
|
||||
"slug": "universal-studios-florida",
|
||||
"operator_slug": "universal-parks-resorts",
|
||||
"property_owner_slug": "universal-parks-resorts",
|
||||
"description": "Movie and television-based theme park in Orlando, Florida.",
|
||||
"opening_date": "1990-06-07",
|
||||
"size_acres": 108,
|
||||
"website": "https://www.universalorlando.com/web/en/us/theme-parks/universal-studios-florida",
|
||||
"location": {
|
||||
"street_address": "6000 Universal Blvd",
|
||||
"city": "Orlando",
|
||||
"state_province": "Florida",
|
||||
"country": "USA",
|
||||
"postal_code": "32819",
|
||||
"latitude": 28.4749,
|
||||
"longitude": -81.4687,
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Cedar Point",
|
||||
"slug": "cedar-point",
|
||||
"operator_slug": "cedar-fair-entertainment",
|
||||
"property_owner_slug": "cedar-fair-entertainment",
|
||||
"description": 'Known as the "Roller Coaster Capital of the World".',
|
||||
"opening_date": "1870-06-01",
|
||||
"size_acres": 364,
|
||||
"website": "https://www.cedarpoint.com/",
|
||||
"location": {
|
||||
"street_address": "1 Cedar Point Dr",
|
||||
"city": "Sandusky",
|
||||
"state_province": "Ohio",
|
||||
"country": "USA",
|
||||
"postal_code": "44870",
|
||||
"latitude": 41.4822,
|
||||
"longitude": -82.6835,
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Six Flags Magic Mountain",
|
||||
"slug": "six-flags-magic-mountain",
|
||||
"operator_slug": "six-flags-entertainment",
|
||||
"property_owner_slug": "six-flags-entertainment",
|
||||
"description": "Known for its world-record 19 roller coasters.",
|
||||
"opening_date": "1971-05-29",
|
||||
"size_acres": 262,
|
||||
"website": "https://www.sixflags.com/magicmountain",
|
||||
"location": {
|
||||
"street_address": "26101 Magic Mountain Pkwy",
|
||||
"city": "Valencia",
|
||||
"state_province": "California",
|
||||
"country": "USA",
|
||||
"postal_code": "91355",
|
||||
"latitude": 34.4253,
|
||||
"longitude": -118.5971,
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Europa-Park",
|
||||
"slug": "europa-park",
|
||||
"operator_slug": "merlin-entertainments",
|
||||
"property_owner_slug": "merlin-entertainments",
|
||||
"description": "One of the most popular theme parks in Europe, located in Germany.",
|
||||
"opening_date": "1975-07-12",
|
||||
"size_acres": 234,
|
||||
"website": "https://www.europapark.de/",
|
||||
"location": {
|
||||
"street_address": "Europa-Park-Straße 2",
|
||||
"city": "Rust",
|
||||
"state_province": "Baden-Württemberg",
|
||||
"country": "Germany",
|
||||
"postal_code": "77977",
|
||||
"latitude": 48.2667,
|
||||
"longitude": 7.7167,
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "Alton Towers",
|
||||
"slug": "alton-towers",
|
||||
"operator_slug": "merlin-entertainments",
|
||||
"property_owner_slug": "merlin-entertainments",
|
||||
"description": "Major theme park and former country estate in Staffordshire, England.",
|
||||
"opening_date": "1980-04-23",
|
||||
"size_acres": 500,
|
||||
# Add other fields as needed
|
||||
},
|
||||
]
|
||||
36
backend/apps/parks/management/commands/fix_migrations.py
Normal file
36
backend/apps/parks/management/commands/fix_migrations.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Fix migration history"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
with connection.cursor() as cursor:
|
||||
# Drop existing historical tables
|
||||
cursor.execute(
|
||||
"""
|
||||
DROP TABLE IF EXISTS parks_historicalpark CASCADE;
|
||||
DROP TABLE IF EXISTS parks_historicalparkarea CASCADE;
|
||||
"""
|
||||
)
|
||||
|
||||
# Delete all existing parks migrations
|
||||
cursor.execute(
|
||||
"""
|
||||
DELETE FROM django_migrations
|
||||
WHERE app = 'parks';
|
||||
"""
|
||||
)
|
||||
|
||||
# Insert the new initial migration
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO django_migrations (app, name, applied)
|
||||
VALUES ('parks', '0001_initial', NOW());
|
||||
"""
|
||||
)
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS("Successfully fixed migration history")
|
||||
)
|
||||
351
backend/apps/parks/management/commands/seed_data.json
Normal file
351
backend/apps/parks/management/commands/seed_data.json
Normal file
@@ -0,0 +1,351 @@
|
||||
{
|
||||
"parks": [
|
||||
{
|
||||
"name": "Walt Disney World Magic Kingdom",
|
||||
"location": "Orlando, Florida",
|
||||
"country": "US",
|
||||
"opening_date": "1971-10-01",
|
||||
"status": "OPERATING",
|
||||
"description": "The most visited theme park in the world, Magic Kingdom is Walt Disney World's first theme park.",
|
||||
"website": "https://disneyworld.disney.go.com/destinations/magic-kingdom/",
|
||||
"owner": "The Walt Disney Company",
|
||||
"size_acres": "142.00",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1524008279394-3aed4643b30b"
|
||||
],
|
||||
"rides": [
|
||||
{
|
||||
"name": "Space Mountain",
|
||||
"category": "RC",
|
||||
"opening_date": "1975-01-15",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Walt Disney Imagineering",
|
||||
"description": "A high-speed roller coaster in the dark through space.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1536768139911-e290a59011e4"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "183.00",
|
||||
"length_ft": "3196.00",
|
||||
"speed_mph": "27.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Big Thunder Mountain Railroad",
|
||||
"category": "RC",
|
||||
"opening_date": "1980-09-23",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Walt Disney Imagineering",
|
||||
"description": "A mine train roller coaster through the Old West.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1513889961551-628c1e5e2ee9"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "104.00",
|
||||
"length_ft": "2671.00",
|
||||
"speed_mph": "30.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 197
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Seven Dwarfs Mine Train",
|
||||
"category": "RC",
|
||||
"opening_date": "2014-05-28",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Vekoma",
|
||||
"description": "A family roller coaster featuring unique swinging cars.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1590144662036-33bf0ebd2c7f"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "112.00",
|
||||
"length_ft": "2000.00",
|
||||
"speed_mph": "34.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Haunted Mansion",
|
||||
"category": "DR",
|
||||
"opening_date": "1971-10-01",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Walt Disney Imagineering",
|
||||
"description": "A dark ride through a haunted estate.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1597466599360-3b9775841aec"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pirates of the Caribbean",
|
||||
"category": "DR",
|
||||
"opening_date": "1973-12-15",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Walt Disney Imagineering",
|
||||
"description": "A boat ride through pirate-filled Caribbean waters.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1506126799754-92bc47fc5d78"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cedar Point",
|
||||
"location": "Sandusky, Ohio",
|
||||
"country": "US",
|
||||
"opening_date": "1870-06-01",
|
||||
"status": "OPERATING",
|
||||
"description": "Known as the Roller Coaster Capital of the World.",
|
||||
"website": "https://www.cedarpoint.com",
|
||||
"owner": "Cedar Fair",
|
||||
"size_acres": "364.00",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1536768139911-e290a59011e4"
|
||||
],
|
||||
"rides": [
|
||||
{
|
||||
"name": "Steel Vengeance",
|
||||
"category": "RC",
|
||||
"opening_date": "2018-05-05",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Rocky Mountain Construction",
|
||||
"description": "A hybrid roller coaster featuring multiple inversions.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1543674892-7d64d45df18b"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "205.00",
|
||||
"length_ft": "5740.00",
|
||||
"speed_mph": "74.00",
|
||||
"inversions": 4,
|
||||
"ride_time_seconds": 150
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Millennium Force",
|
||||
"category": "RC",
|
||||
"opening_date": "2000-05-13",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Intamin",
|
||||
"description": "A giga coaster with stunning views of Lake Erie.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1605559911160-a3d95d213904"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "310.00",
|
||||
"length_ft": "6595.00",
|
||||
"speed_mph": "93.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 120
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Top Thrill Dragster",
|
||||
"category": "RC",
|
||||
"opening_date": "2003-05-04",
|
||||
"status": "SBNO",
|
||||
"manufacturer": "Intamin",
|
||||
"description": "A strata coaster featuring a 420-foot top hat element.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1578912996078-305d92249aa6"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "420.00",
|
||||
"length_ft": "2800.00",
|
||||
"speed_mph": "120.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 50
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Maverick",
|
||||
"category": "RC",
|
||||
"opening_date": "2007-05-26",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Intamin",
|
||||
"description": "A launched roller coaster with multiple inversions.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1581309638082-877cb8132535"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "105.00",
|
||||
"length_ft": "4450.00",
|
||||
"speed_mph": "70.00",
|
||||
"inversions": 2,
|
||||
"ride_time_seconds": 150
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Universal's Islands of Adventure",
|
||||
"location": "Orlando, Florida",
|
||||
"country": "US",
|
||||
"opening_date": "1999-05-28",
|
||||
"status": "OPERATING",
|
||||
"description": "A theme park featuring cutting-edge technology and thrilling attractions.",
|
||||
"website": "https://www.universalorlando.com/web/en/us/theme-parks/islands-of-adventure",
|
||||
"owner": "NBCUniversal",
|
||||
"size_acres": "110.00",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1597466599360-3b9775841aec"
|
||||
],
|
||||
"rides": [
|
||||
{
|
||||
"name": "Jurassic World VelociCoaster",
|
||||
"category": "RC",
|
||||
"opening_date": "2021-06-10",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Intamin",
|
||||
"description": "A high-speed launch coaster featuring velociraptors.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1536768139911-e290a59011e4"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "155.00",
|
||||
"length_ft": "4700.00",
|
||||
"speed_mph": "70.00",
|
||||
"inversions": 4,
|
||||
"ride_time_seconds": 145
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Hagrid's Magical Creatures Motorbike Adventure",
|
||||
"category": "RC",
|
||||
"opening_date": "2019-06-13",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Intamin",
|
||||
"description": "A story coaster through the Forbidden Forest.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1513889961551-628c1e5e2ee9"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "65.00",
|
||||
"length_ft": "5053.00",
|
||||
"speed_mph": "50.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "The Amazing Adventures of Spider-Man",
|
||||
"category": "DR",
|
||||
"opening_date": "1999-05-28",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Oceaneering International",
|
||||
"description": "A 3D dark ride featuring Spider-Man.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1590144662036-33bf0ebd2c7f"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Alton Towers",
|
||||
"location": "Alton, England",
|
||||
"country": "GB",
|
||||
"opening_date": "1980-04-04",
|
||||
"status": "OPERATING",
|
||||
"description": "The UK's largest theme park, built around a historic stately home.",
|
||||
"website": "https://www.altontowers.com",
|
||||
"owner": "Merlin Entertainments",
|
||||
"size_acres": "910.00",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1506126799754-92bc47fc5d78"
|
||||
],
|
||||
"rides": [
|
||||
{
|
||||
"name": "Nemesis",
|
||||
"category": "RC",
|
||||
"opening_date": "1994-03-19",
|
||||
"status": "CLOSED",
|
||||
"manufacturer": "Bolliger & Mabillard",
|
||||
"description": "An inverted roller coaster through ravines.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1543674892-7d64d45df18b"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "43.00",
|
||||
"length_ft": "2349.00",
|
||||
"speed_mph": "50.00",
|
||||
"inversions": 4,
|
||||
"ride_time_seconds": 80
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Oblivion",
|
||||
"category": "RC",
|
||||
"opening_date": "1998-03-14",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Bolliger & Mabillard",
|
||||
"description": "The world's first vertical drop roller coaster.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1605559911160-a3d95d213904"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "65.00",
|
||||
"length_ft": "1804.00",
|
||||
"speed_mph": "68.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 100
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Europa-Park",
|
||||
"location": "Rust, Germany",
|
||||
"country": "DE",
|
||||
"opening_date": "1975-07-12",
|
||||
"status": "OPERATING",
|
||||
"description": "Germany's largest theme park, featuring European-themed areas.",
|
||||
"website": "https://www.europapark.de",
|
||||
"owner": "Mack Rides",
|
||||
"size_acres": "235.00",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1536768139911-e290a59011e4"
|
||||
],
|
||||
"rides": [
|
||||
{
|
||||
"name": "Silver Star",
|
||||
"category": "RC",
|
||||
"opening_date": "2002-03-23",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Bolliger & Mabillard",
|
||||
"description": "A hypercoaster with stunning views.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1536768139911-e290a59011e4"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "239.00",
|
||||
"length_ft": "4003.00",
|
||||
"speed_mph": "79.00",
|
||||
"inversions": 0,
|
||||
"ride_time_seconds": 180
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Blue Fire",
|
||||
"category": "RC",
|
||||
"opening_date": "2009-04-04",
|
||||
"status": "OPERATING",
|
||||
"manufacturer": "Mack Rides",
|
||||
"description": "A launched roller coaster with multiple inversions.",
|
||||
"photos": [
|
||||
"https://images.unsplash.com/photo-1513889961551-628c1e5e2ee9"
|
||||
],
|
||||
"stats": {
|
||||
"height_ft": "125.00",
|
||||
"length_ft": "3465.00",
|
||||
"speed_mph": "62.00",
|
||||
"inversions": 4,
|
||||
"ride_time_seconds": 150
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
334
backend/apps/parks/management/commands/seed_initial_data.py
Normal file
334
backend/apps/parks/management/commands/seed_initial_data.py
Normal file
@@ -0,0 +1,334 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from apps.parks.models import Park, ParkArea, ParkLocation, Company as Operator
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Seeds initial park data with major theme parks worldwide"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
# Create major theme park companies
|
||||
companies_data = [
|
||||
{
|
||||
"name": "The Walt Disney Company",
|
||||
"website": "https://www.disney.com/",
|
||||
"headquarters": "Burbank, California",
|
||||
"description": "The world's largest entertainment company and theme park operator.",
|
||||
},
|
||||
{
|
||||
"name": "Universal Parks & Resorts",
|
||||
"website": "https://www.universalparks.com/",
|
||||
"headquarters": "Orlando, Florida",
|
||||
"description": "A division of Comcast NBCUniversal, operating major theme parks worldwide.",
|
||||
},
|
||||
{
|
||||
"name": "Six Flags Entertainment Corporation",
|
||||
"website": "https://www.sixflags.com/",
|
||||
"headquarters": "Arlington, Texas",
|
||||
"description": "The world's largest regional theme park company.",
|
||||
},
|
||||
{
|
||||
"name": "Cedar Fair Entertainment Company",
|
||||
"website": "https://www.cedarfair.com/",
|
||||
"headquarters": "Sandusky, Ohio",
|
||||
"description": "One of North America's largest operators of regional amusement parks.",
|
||||
},
|
||||
{
|
||||
"name": "Herschend Family Entertainment",
|
||||
"website": "https://www.hfecorp.com/",
|
||||
"headquarters": "Atlanta, Georgia",
|
||||
"description": "The largest family-owned themed attractions corporation in the United States.",
|
||||
},
|
||||
{
|
||||
"name": "SeaWorld Parks & Entertainment",
|
||||
"website": "https://www.seaworldentertainment.com/",
|
||||
"headquarters": "Orlando, Florida",
|
||||
"description": "Theme park and entertainment company focusing on nature-based themes.",
|
||||
},
|
||||
]
|
||||
|
||||
companies = {}
|
||||
for company_data in companies_data:
|
||||
operator, created = Operator.objects.get_or_create(
|
||||
name=company_data["name"], defaults=company_data
|
||||
)
|
||||
companies[operator.name] = operator
|
||||
self.stdout.write(
|
||||
f'{"Created" if created else "Found"} company: {operator.name}'
|
||||
)
|
||||
|
||||
# Create parks with their locations
|
||||
parks_data = [
|
||||
{
|
||||
"name": "Magic Kingdom",
|
||||
"company": "The Walt Disney Company",
|
||||
"description": "The first theme park at Walt Disney World Resort in Florida, opened in 1971.",
|
||||
"opening_date": "1971-10-01",
|
||||
"size_acres": 142,
|
||||
"location": {
|
||||
"street_address": "1180 Seven Seas Dr",
|
||||
"city": "Lake Buena Vista",
|
||||
"state": "Florida",
|
||||
"country": "United States",
|
||||
"postal_code": "32830",
|
||||
"latitude": 28.4177,
|
||||
"longitude": -81.5812,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Main Street, U.S.A.",
|
||||
"description": "Victorian-era themed entrance corridor",
|
||||
},
|
||||
{
|
||||
"name": "Adventureland",
|
||||
"description": "Exotic tropical places themed area",
|
||||
},
|
||||
{
|
||||
"name": "Frontierland",
|
||||
"description": "American Old West themed area",
|
||||
},
|
||||
{
|
||||
"name": "Liberty Square",
|
||||
"description": "Colonial America themed area",
|
||||
},
|
||||
{
|
||||
"name": "Fantasyland",
|
||||
"description": "Fairy tale themed area",
|
||||
},
|
||||
{
|
||||
"name": "Tomorrowland",
|
||||
"description": "Future themed area",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Universal Studios Florida",
|
||||
"company": "Universal Parks & Resorts",
|
||||
"description": "Movie and television-based theme park in Orlando, Florida.",
|
||||
"opening_date": "1990-06-07",
|
||||
"size_acres": 108,
|
||||
"location": {
|
||||
"street_address": "6000 Universal Blvd",
|
||||
"city": "Orlando",
|
||||
"state": "Florida",
|
||||
"country": "United States",
|
||||
"postal_code": "32819",
|
||||
"latitude": 28.4749,
|
||||
"longitude": -81.4687,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Production Central",
|
||||
"description": "Main entrance area with movie-themed attractions",
|
||||
},
|
||||
{
|
||||
"name": "New York",
|
||||
"description": "Themed after New York City streets",
|
||||
},
|
||||
{
|
||||
"name": "San Francisco",
|
||||
"description": "Themed after San Francisco's waterfront",
|
||||
},
|
||||
{
|
||||
"name": "The Wizarding World of Harry Potter - Diagon Alley",
|
||||
"description": "Themed after the Harry Potter series",
|
||||
},
|
||||
{
|
||||
"name": "Springfield",
|
||||
"description": "Themed after The Simpsons hometown",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Cedar Point",
|
||||
"company": "Cedar Fair Entertainment Company",
|
||||
"description": 'Known as the "Roller Coaster Capital of the World".',
|
||||
"opening_date": "1870-06-01",
|
||||
"size_acres": 364,
|
||||
"location": {
|
||||
"street_address": "1 Cedar Point Dr",
|
||||
"city": "Sandusky",
|
||||
"state": "Ohio",
|
||||
"country": "United States",
|
||||
"postal_code": "44870",
|
||||
"latitude": 41.4822,
|
||||
"longitude": -82.6835,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Frontiertown",
|
||||
"description": "Western-themed area with multiple roller coasters",
|
||||
},
|
||||
{
|
||||
"name": "Millennium Island",
|
||||
"description": "Home to the Millennium Force roller coaster",
|
||||
},
|
||||
{
|
||||
"name": "Cedar Point Shores",
|
||||
"description": "Waterpark area",
|
||||
},
|
||||
{
|
||||
"name": "Top Thrill Dragster",
|
||||
"description": "Area surrounding the iconic launched coaster",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Silver Dollar City",
|
||||
"company": "Herschend Family Entertainment",
|
||||
"description": "An 1880s-themed park featuring over 40 rides and attractions.",
|
||||
"opening_date": "1960-05-01",
|
||||
"size_acres": 61,
|
||||
"location": {
|
||||
"street_address": "399 Silver Dollar City Parkway",
|
||||
"city": "Branson",
|
||||
"state": "Missouri",
|
||||
"country": "United States",
|
||||
"postal_code": "65616",
|
||||
"latitude": 36.668497,
|
||||
"longitude": -93.339074,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Grand Exposition",
|
||||
"description": "Home to many family rides and attractions",
|
||||
},
|
||||
{
|
||||
"name": "Wildfire",
|
||||
"description": "Named after the famous B&M coaster",
|
||||
},
|
||||
{
|
||||
"name": "Wilson's Farm",
|
||||
"description": "Farm-themed attractions and dining",
|
||||
},
|
||||
{
|
||||
"name": "Riverfront",
|
||||
"description": "Water-themed attractions area",
|
||||
},
|
||||
{
|
||||
"name": "The Valley",
|
||||
"description": "Home to Time Traveler and other major attractions",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Six Flags Magic Mountain",
|
||||
"company": "Six Flags Entertainment Corporation",
|
||||
"description": "Known for its world-record 19 roller coasters.",
|
||||
"opening_date": "1971-05-29",
|
||||
"size_acres": 262,
|
||||
"location": {
|
||||
"street_address": "26101 Magic Mountain Pkwy",
|
||||
"city": "Valencia",
|
||||
"state": "California",
|
||||
"country": "United States",
|
||||
"postal_code": "91355",
|
||||
"latitude": 34.4253,
|
||||
"longitude": -118.5971,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Six Flags Plaza",
|
||||
"description": "Main entrance area",
|
||||
},
|
||||
{
|
||||
"name": "DC Universe",
|
||||
"description": "DC Comics themed area",
|
||||
},
|
||||
{
|
||||
"name": "Screampunk District",
|
||||
"description": "Steampunk themed area",
|
||||
},
|
||||
{
|
||||
"name": "The Underground",
|
||||
"description": "Urban themed area",
|
||||
},
|
||||
{
|
||||
"name": "Goliath Territory",
|
||||
"description": "Area surrounding the Goliath hypercoaster",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "SeaWorld Orlando",
|
||||
"company": "SeaWorld Parks & Entertainment",
|
||||
"description": "Marine zoological park combined with thrill rides and shows.",
|
||||
"opening_date": "1973-12-15",
|
||||
"size_acres": 200,
|
||||
"location": {
|
||||
"street_address": "7007 Sea World Dr",
|
||||
"city": "Orlando",
|
||||
"state": "Florida",
|
||||
"country": "United States",
|
||||
"postal_code": "32821",
|
||||
"latitude": 28.4115,
|
||||
"longitude": -81.4617,
|
||||
},
|
||||
"areas": [
|
||||
{
|
||||
"name": "Sea Harbor",
|
||||
"description": "Main entrance and shopping area",
|
||||
},
|
||||
{
|
||||
"name": "Shark Encounter",
|
||||
"description": "Shark exhibit and themed area",
|
||||
},
|
||||
{
|
||||
"name": "Antarctica: Empire of the Penguin",
|
||||
"description": "Penguin-themed area",
|
||||
},
|
||||
{
|
||||
"name": "Manta",
|
||||
"description": "Area themed around the Manta flying roller coaster",
|
||||
},
|
||||
{
|
||||
"name": "Sesame Street Land",
|
||||
"description": "Kid-friendly area based on Sesame Street",
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
# Create parks and their areas
|
||||
for park_data in parks_data:
|
||||
company = companies[park_data["company"]]
|
||||
park, created = Park.objects.get_or_create(
|
||||
name=park_data["name"],
|
||||
defaults={
|
||||
"description": park_data["description"],
|
||||
"status": "OPERATING",
|
||||
"opening_date": park_data["opening_date"],
|
||||
"size_acres": park_data["size_acres"],
|
||||
"owner": company,
|
||||
},
|
||||
)
|
||||
self.stdout.write(f'{"Created" if created else "Found"} park: {park.name}')
|
||||
|
||||
# Create location for park
|
||||
if created:
|
||||
loc_data = park_data["location"]
|
||||
park_location = ParkLocation.objects.create(
|
||||
park=park,
|
||||
street_address=loc_data["street_address"],
|
||||
city=loc_data["city"],
|
||||
state=loc_data["state"],
|
||||
country=loc_data["country"],
|
||||
postal_code=loc_data["postal_code"],
|
||||
)
|
||||
# Set coordinates using the helper method
|
||||
park_location.set_coordinates(
|
||||
loc_data["latitude"], loc_data["longitude"]
|
||||
)
|
||||
park_location.save()
|
||||
|
||||
# Create areas for park
|
||||
for area_data in park_data["areas"]:
|
||||
area, created = ParkArea.objects.get_or_create(
|
||||
name=area_data["name"],
|
||||
park=park,
|
||||
defaults={"description": area_data["description"]},
|
||||
)
|
||||
self.stdout.write(
|
||||
f'{"Created" if created else "Found"} area: {area.name} in {park.name}'
|
||||
)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Successfully seeded initial park data"))
|
||||
1173
backend/apps/parks/management/commands/seed_sample_data.py
Normal file
1173
backend/apps/parks/management/commands/seed_sample_data.py
Normal file
File diff suppressed because it is too large
Load Diff
124
backend/apps/parks/management/commands/test_location.py
Normal file
124
backend/apps/parks/management/commands/test_location.py
Normal file
@@ -0,0 +1,124 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from apps.parks.models import Park, ParkLocation, Company
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Test ParkLocation model functionality"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write("🧪 Testing ParkLocation Model Functionality")
|
||||
self.stdout.write("=" * 50)
|
||||
|
||||
# Create a test company (operator)
|
||||
operator, created = Company.objects.get_or_create(
|
||||
name="Test Theme Parks Inc",
|
||||
defaults={"slug": "test-theme-parks-inc", "roles": ["OPERATOR"]},
|
||||
)
|
||||
self.stdout.write(f"✅ Created operator: {operator.name}")
|
||||
|
||||
# Create a test park
|
||||
park, created = Park.objects.get_or_create(
|
||||
name="Test Magic Kingdom",
|
||||
defaults={
|
||||
"slug": "test-magic-kingdom",
|
||||
"description": "A test theme park for location testing",
|
||||
"operator": operator,
|
||||
},
|
||||
)
|
||||
self.stdout.write(f"✅ Created park: {park.name}")
|
||||
|
||||
# Create a park location
|
||||
location, created = ParkLocation.objects.get_or_create(
|
||||
park=park,
|
||||
defaults={
|
||||
"street_address": "1313 Disneyland Dr",
|
||||
"city": "Anaheim",
|
||||
"state": "California",
|
||||
"country": "USA",
|
||||
"postal_code": "92802",
|
||||
"highway_exit": "I-5 Exit 110B",
|
||||
"parking_notes": "Large parking structure available",
|
||||
"seasonal_notes": "Open year-round",
|
||||
},
|
||||
)
|
||||
self.stdout.write(f"✅ Created location: {location}")
|
||||
|
||||
# Test coordinate setting
|
||||
self.stdout.write("\n🔍 Testing coordinate functionality:")
|
||||
location.set_coordinates(33.8121, -117.9190) # Disneyland coordinates
|
||||
location.save()
|
||||
|
||||
self.stdout.write(f" Latitude: {location.latitude}")
|
||||
self.stdout.write(f" Longitude: {location.longitude}")
|
||||
self.stdout.write(f" Coordinates: {location.coordinates}")
|
||||
self.stdout.write(f" Formatted Address: {location.formatted_address}")
|
||||
|
||||
# Test Park model integration
|
||||
self.stdout.write("\n🔍 Testing Park model integration:")
|
||||
self.stdout.write(
|
||||
f" Park formatted location: {
|
||||
park.formatted_location}"
|
||||
)
|
||||
self.stdout.write(f" Park coordinates: {park.coordinates}")
|
||||
|
||||
# Create another location for distance testing
|
||||
operator2, created = Company.objects.get_or_create(
|
||||
name="Six Flags Entertainment",
|
||||
defaults={
|
||||
"slug": "six-flags-entertainment",
|
||||
"roles": ["OPERATOR"],
|
||||
},
|
||||
)
|
||||
|
||||
park2, created = Park.objects.get_or_create(
|
||||
name="Six Flags Magic Mountain",
|
||||
defaults={
|
||||
"slug": "six-flags-magic-mountain",
|
||||
"description": "Another test theme park",
|
||||
"operator": operator2,
|
||||
},
|
||||
)
|
||||
|
||||
location2, created = ParkLocation.objects.get_or_create(
|
||||
park=park2,
|
||||
defaults={
|
||||
"city": "Valencia",
|
||||
"state": "California",
|
||||
"country": "USA",
|
||||
},
|
||||
)
|
||||
location2.set_coordinates(
|
||||
34.4244, -118.5971
|
||||
) # Six Flags Magic Mountain coordinates
|
||||
location2.save()
|
||||
|
||||
# Test distance calculation
|
||||
self.stdout.write("\n🔍 Testing distance calculation:")
|
||||
distance = location.distance_to(location2)
|
||||
if distance:
|
||||
self.stdout.write(f" Distance between parks: {distance:.2f} km")
|
||||
else:
|
||||
self.stdout.write(" ❌ Distance calculation failed")
|
||||
|
||||
# Test spatial indexing
|
||||
self.stdout.write("\n🔍 Testing spatial queries:")
|
||||
try:
|
||||
from django.contrib.gis.measure import D
|
||||
from django.contrib.gis.geos import Point
|
||||
|
||||
# Find parks within 100km of a point
|
||||
# Same as Disneyland
|
||||
search_point = Point(-117.9190, 33.8121, srid=4326)
|
||||
nearby_locations = ParkLocation.objects.filter(
|
||||
point__distance_lte=(search_point, D(km=100))
|
||||
)
|
||||
self.stdout.write(
|
||||
f" Found {
|
||||
nearby_locations.count()} parks within 100km"
|
||||
)
|
||||
for loc in nearby_locations:
|
||||
self.stdout.write(f" - {loc.park.name} in {loc.city}, {loc.state}")
|
||||
except Exception as e:
|
||||
self.stdout.write(f" ⚠️ Spatial queries not fully functional: {e}")
|
||||
|
||||
self.stdout.write("\n✅ ParkLocation model tests completed successfully!")
|
||||
29
backend/apps/parks/management/commands/update_park_counts.py
Normal file
29
backend/apps/parks/management/commands/update_park_counts.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Q
|
||||
from apps.parks.models import Park
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Update total_rides and total_roller_coasters counts for all parks"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
parks = Park.objects.all()
|
||||
operating_rides = Q(status="OPERATING")
|
||||
updated = 0
|
||||
|
||||
for park in parks:
|
||||
# Count total operating rides
|
||||
total_rides = park.rides.filter(operating_rides).count()
|
||||
|
||||
# Count total operating roller coasters
|
||||
total_coasters = park.rides.filter(operating_rides, category="RC").count()
|
||||
|
||||
# Update park counts
|
||||
Park.objects.filter(id=park.id).update(
|
||||
total_rides=total_rides, total_roller_coasters=total_coasters
|
||||
)
|
||||
updated += 1
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f"Successfully updated counts for {updated} parks")
|
||||
)
|
||||
Reference in New Issue
Block a user