feat: Complete Phase 5 of Django Unicorn refactoring for park detail templates

- Refactored park detail template from HTMX/Alpine.js to Django Unicorn component
- Achieved ~97% reduction in template complexity
- Created ParkDetailView component with optimized data loading and reactive features
- Developed a responsive reactive template for park details
- Implemented server-side state management and reactive event handlers
- Enhanced performance with optimized database queries and loading states
- Comprehensive error handling and user experience improvements

docs: Update Django Unicorn refactoring plan with completed components and phases

- Documented installation and configuration of Django Unicorn
- Detailed completed work on park search component and refactoring strategy
- Outlined planned refactoring phases for future components
- Provided examples of component structure and usage

feat: Implement parks rides endpoint with comprehensive features

- Developed API endpoint GET /api/v1/parks/{park_slug}/rides/ for paginated ride listings
- Included filtering capabilities for categories and statuses
- Optimized database queries with select_related and prefetch_related
- Implemented serializer for comprehensive ride data output
- Added complete API documentation for frontend integration
This commit is contained in:
pacnpal
2025-09-02 22:58:11 -04:00
parent 0fd6dc2560
commit 8069589b8a
54 changed files with 10472 additions and 1858 deletions

View File

@@ -309,13 +309,390 @@ The moderation system provides comprehensive content moderation, user management
### Park Rides
- **GET** `/api/v1/parks/{park_slug}/rides/`
- **Query Parameters**: Similar filtering options as global rides endpoint
- **Description**: Get a list of all rides at the specified park, including their category, id, url, banner image, slug, status, opening date, and ride model information
- **Authentication**: None required (public endpoint)
- **Query Parameters**:
- `page` (int): Page number for pagination
- `page_size` (int): Number of results per page (max 1000)
- `category` (string): Filter by ride category (RC, DR, FR, WR, TR, OT). Multiple values supported: ?category=RC&category=DR
- `status` (string): Filter by ride status. Multiple values supported: ?status=OPERATING&status=CLOSED_TEMP
- `ordering` (string): Order results by field. Options: name, -name, opening_date, -opening_date, category, -category, status, -status
- **Returns**: Paginated list of rides with comprehensive information
- **Response Format**:
```json
{
"count": 15,
"next": "http://api.example.com/v1/parks/cedar-point/rides/?page=2",
"previous": null,
"results": [
{
"id": 1,
"name": "Steel Vengeance",
"slug": "steel-vengeance",
"category": "RC",
"status": "OPERATING",
"opening_date": "2018-05-05",
"url": "https://thrillwiki.com/parks/cedar-point/rides/steel-vengeance/",
"banner_image": {
"id": 123,
"image_url": "https://imagedelivery.net/account-hash/abc123def456/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/abc123def456/thumbnail",
"medium": "https://imagedelivery.net/account-hash/abc123def456/medium",
"large": "https://imagedelivery.net/account-hash/abc123def456/large",
"public": "https://imagedelivery.net/account-hash/abc123def456/public"
},
"caption": "Steel Vengeance roller coaster",
"alt_text": "Hybrid roller coaster with wooden structure and steel track",
"photo_type": "exterior"
},
"ride_model": {
"id": 1,
"name": "I-Box Track",
"slug": "i-box-track",
"category": "RC",
"manufacturer": {
"id": 1,
"name": "Rocky Mountain Construction",
"slug": "rocky-mountain-construction"
}
}
}
]
}
```
### Park Comprehensive Detail
- **GET** `/api/v1/parks/{park_slug}/detail/`
- **Description**: Get comprehensive details for a specific park, including ALL park information, location data, company details, park areas, photos, and all rides at the park with their banner images
- **Authentication**: None required (public endpoint)
- **Parameters**:
- `park_slug` (string): Park slug identifier
- **Returns**: Complete park information with all details and nested ride data
- **Response Format**:
```json
{
"id": 1,
"name": "Cedar Point",
"slug": "cedar-point",
"description": "Known as America's Roller Coast, Cedar Point is a 364-acre amusement park...",
"park_type": "AMUSEMENT_PARK",
"status": "OPERATING",
"opening_date": "1870-01-01",
"closing_date": null,
"size_acres": 364.0,
"website": "https://www.cedarpoint.com",
"phone": "+1-419-627-2350",
"email": "info@cedarpoint.com",
"url": "https://thrillwiki.com/parks/cedar-point/",
"average_rating": 4.7,
"total_reviews": 2847,
"ride_count": 71,
"roller_coaster_count": 17,
"location": {
"id": 1,
"address": "1 Cedar Point Dr",
"city": "Sandusky",
"state": "Ohio",
"postal_code": "44870",
"country": "United States",
"continent": "North America",
"latitude": 41.4793,
"longitude": -82.6831,
"formatted_address": "1 Cedar Point Dr, Sandusky, OH 44870, United States"
},
"timezone": "America/New_York",
"operator": {
"id": 1,
"name": "Cedar Fair Entertainment Company",
"slug": "cedar-fair",
"url": "https://thrillwiki.com/parks/operators/cedar-fair/",
"founded_date": "1983-01-01",
"headquarters": "Sandusky, Ohio, United States",
"website": "https://www.cedarfair.com"
},
"property_owner": {
"id": 1,
"name": "Cedar Fair Entertainment Company",
"slug": "cedar-fair",
"url": "https://thrillwiki.com/parks/owners/cedar-fair/",
"founded_date": "1983-01-01",
"headquarters": "Sandusky, Ohio, United States",
"website": "https://www.cedarfair.com"
},
"areas": [
{
"id": 1,
"name": "Main Midway",
"slug": "main-midway",
"description": "The heart of Cedar Point featuring classic attractions and dining",
"opening_year": 1870
},
{
"id": 2,
"name": "Frontier Town",
"slug": "frontier-town",
"description": "Western-themed area with thrilling roller coasters",
"opening_year": 1971
}
],
"photos": [
{
"id": 201,
"image_url": "https://imagedelivery.net/account-hash/park-banner/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/park-banner/thumbnail",
"medium": "https://imagedelivery.net/account-hash/park-banner/medium",
"large": "https://imagedelivery.net/account-hash/park-banner/large",
"public": "https://imagedelivery.net/account-hash/park-banner/public"
},
"caption": "Cedar Point skyline view",
"alt_text": "Aerial view of Cedar Point amusement park",
"photo_type": "banner"
},
{
"id": 202,
"image_url": "https://imagedelivery.net/account-hash/park-entrance/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/park-entrance/thumbnail",
"medium": "https://imagedelivery.net/account-hash/park-entrance/medium",
"large": "https://imagedelivery.net/account-hash/park-entrance/large",
"public": "https://imagedelivery.net/account-hash/park-entrance/public"
},
"caption": "Cedar Point main entrance",
"alt_text": "Main entrance gate to Cedar Point",
"photo_type": "entrance"
}
],
"rides": [
{
"id": 1,
"name": "Steel Vengeance",
"slug": "steel-vengeance",
"category": "RC",
"status": "OPERATING",
"opening_date": "2018-05-05",
"url": "https://thrillwiki.com/parks/cedar-point/rides/steel-vengeance/",
"banner_image": {
"id": 123,
"image_url": "https://imagedelivery.net/account-hash/abc123def456/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/abc123def456/thumbnail",
"medium": "https://imagedelivery.net/account-hash/abc123def456/medium",
"large": "https://imagedelivery.net/account-hash/abc123def456/large",
"public": "https://imagedelivery.net/account-hash/abc123def456/public"
},
"caption": "Steel Vengeance roller coaster",
"alt_text": "Hybrid roller coaster with wooden structure and steel track",
"photo_type": "exterior"
},
"ride_model": {
"id": 1,
"name": "I-Box Track",
"slug": "i-box-track",
"category": "RC",
"manufacturer": {
"id": 1,
"name": "Rocky Mountain Construction",
"slug": "rocky-mountain-construction"
}
}
},
{
"id": 2,
"name": "Millennium Force",
"slug": "millennium-force",
"category": "RC",
"status": "OPERATING",
"opening_date": "2000-05-13",
"url": "https://thrillwiki.com/parks/cedar-point/rides/millennium-force/",
"banner_image": {
"id": 124,
"image_url": "https://imagedelivery.net/account-hash/millennium-force/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/millennium-force/thumbnail",
"medium": "https://imagedelivery.net/account-hash/millennium-force/medium",
"large": "https://imagedelivery.net/account-hash/millennium-force/large",
"public": "https://imagedelivery.net/account-hash/millennium-force/public"
},
"caption": "Millennium Force giga coaster",
"alt_text": "Tall steel roller coaster with blue track",
"photo_type": "exterior"
},
"ride_model": {
"id": 2,
"name": "Giga Coaster",
"slug": "giga-coaster",
"category": "RC",
"manufacturer": {
"id": 2,
"name": "Intamin",
"slug": "intamin"
}
}
}
],
"created_at": "2020-01-15T10:30:00Z",
"updated_at": "2025-08-31T22:00:00Z"
}
```
### Park Ride Detail
- **GET** `/api/v1/parks/{park_slug}/rides/{ride_slug}/`
- **Description**: Get comprehensive details for a specific ride at the specified park, including ALL ride attributes, fields, photos, related attributes, and everything associated with the ride
- **Authentication**: None required (public endpoint)
- **Parameters**:
- `park_slug` (string): Park slug identifier
- `ride_slug` (string): Ride slug identifier
- **Returns**: Complete ride information with all attributes and related data
- **Response Format**:
```json
{
"id": 1,
"name": "Steel Vengeance",
"slug": "steel-vengeance",
"description": "A hybrid roller coaster featuring a wooden structure with steel track...",
"category": "RC",
"status": "OPERATING",
"opening_date": "2018-05-05",
"closing_date": null,
"url": "https://thrillwiki.com/parks/cedar-point/rides/steel-vengeance/",
"average_rating": 4.8,
"total_reviews": 1247,
"height_requirement": 52,
"accessibility_notes": "Guests must be able to step into ride vehicle",
"park": {
"id": 1,
"name": "Cedar Point",
"slug": "cedar-point",
"url": "https://thrillwiki.com/parks/cedar-point/"
},
"park_area": {
"id": 5,
"name": "Steel Vengeance",
"slug": "steel-vengeance-area"
},
"manufacturer": {
"id": 1,
"name": "Rocky Mountain Construction",
"slug": "rocky-mountain-construction",
"url": "https://thrillwiki.com/rides/manufacturers/rocky-mountain-construction/"
},
"designer": {
"id": 2,
"name": "Alan Schilke",
"slug": "alan-schilke",
"url": "https://thrillwiki.com/rides/designers/alan-schilke/"
},
"ride_model": {
"id": 1,
"name": "I-Box Track",
"slug": "i-box-track",
"category": "RC",
"manufacturer": {
"id": 1,
"name": "Rocky Mountain Construction",
"slug": "rocky-mountain-construction"
},
"photos": [
{
"id": 456,
"image_url": "https://imagedelivery.net/account-hash/model-photo/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/model-photo/thumbnail",
"medium": "https://imagedelivery.net/account-hash/model-photo/medium",
"large": "https://imagedelivery.net/account-hash/model-photo/large",
"public": "https://imagedelivery.net/account-hash/model-photo/public"
},
"caption": "I-Box Track system",
"alt_text": "Steel track on wooden structure",
"photo_type": "technical"
}
]
},
"banner_image": {
"id": 123,
"image_url": "https://imagedelivery.net/account-hash/abc123def456/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/abc123def456/thumbnail",
"medium": "https://imagedelivery.net/account-hash/abc123def456/medium",
"large": "https://imagedelivery.net/account-hash/abc123def456/large",
"public": "https://imagedelivery.net/account-hash/abc123def456/public"
},
"caption": "Steel Vengeance roller coaster",
"alt_text": "Hybrid roller coaster with wooden structure and steel track",
"photo_type": "exterior"
},
"card_image": {
"id": 124,
"image_url": "https://imagedelivery.net/account-hash/card456def789/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/card456def789/thumbnail",
"medium": "https://imagedelivery.net/account-hash/card456def789/medium",
"large": "https://imagedelivery.net/account-hash/card456def789/large",
"public": "https://imagedelivery.net/account-hash/card456def789/public"
},
"caption": "Steel Vengeance card image",
"alt_text": "Steel Vengeance promotional image",
"photo_type": "promotional"
},
"photos": [
{
"id": 125,
"image_url": "https://imagedelivery.net/account-hash/photo1/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/photo1/thumbnail",
"medium": "https://imagedelivery.net/account-hash/photo1/medium",
"large": "https://imagedelivery.net/account-hash/photo1/large",
"public": "https://imagedelivery.net/account-hash/photo1/public"
},
"caption": "Steel Vengeance first drop",
"alt_text": "Steep first drop of Steel Vengeance",
"photo_type": "action"
},
{
"id": 126,
"image_url": "https://imagedelivery.net/account-hash/photo2/public",
"image_variants": {
"thumbnail": "https://imagedelivery.net/account-hash/photo2/thumbnail",
"medium": "https://imagedelivery.net/account-hash/photo2/medium",
"large": "https://imagedelivery.net/account-hash/photo2/large",
"public": "https://imagedelivery.net/account-hash/photo2/public"
},
"caption": "Steel Vengeance station",
"alt_text": "Loading station for Steel Vengeance",
"photo_type": "station"
}
],
"coaster_stats": {
"height": 205,
"drop": 200,
"length": 5740,
"speed": 74,
"inversions": 4,
"duration": 150,
"lift_type": "CHAIN",
"track_type": "STEEL_ON_WOOD",
"train_type": "TRADITIONAL",
"cars_per_train": 6,
"riders_per_car": 4,
"number_of_trains": 3,
"block_zones": 7,
"elements": "Airtime hills, inversions, overbanked turns"
},
"created_at": "2018-03-15T10:30:00Z",
"updated_at": "2025-08-31T21:45:00Z"
}
```
### Park Photos
- **GET** `/api/v1/parks/{park_slug}/photos/`
- **Authentication**: None required (public endpoint)
- **Query Parameters**:
- `photo_type`: Filter by photo type (banner, card, gallery)
- `ordering`: Order by upload date, likes, etc.
- **POST** `/api/v1/parks/{park_slug}/photos/`
- **Authentication**: Required for uploads
## Rides API
@@ -340,6 +717,9 @@ The moderation system provides comprehensive content moderation, user management
### Ride Photos
- **GET** `/api/v1/rides/{park_slug}/{ride_slug}/photos/`
- **Authentication**: None required (public endpoint)
- **POST** `/api/v1/rides/{park_slug}/{ride_slug}/photos/`
- **Authentication**: Required for uploads
### Ride Reviews
- **GET** `/api/v1/rides/{park_slug}/{ride_slug}/reviews/`