Add enums for ReviewStatus, TrackMaterial, LaunchType, RideCategory, and RollerCoasterType; implement Designer and RideModel models; create migrations for ride_models and helpful_votes tables; enhance RideGalleryComponent documentation

This commit is contained in:
pacnpal
2025-02-25 20:37:19 -05:00
parent 8951e59f49
commit 64b0e90a27
35 changed files with 3157 additions and 1 deletions

View File

@@ -0,0 +1,133 @@
# Ride Reviews Feature
## Overview
The ride reviews system allows users to rate and review rides, providing both numerical ratings and textual feedback. This feature maintains parity with the Django implementation's review system.
## Database Schema
### reviews Table
- id (primary key)
- ride_id (foreign key to rides)
- user_id (foreign key to users)
- rating (integer, 1-5)
- title (string, optional)
- content (text)
- created_at (timestamp)
- updated_at (timestamp)
- moderated_at (timestamp, nullable)
- moderated_by (foreign key to users, nullable)
- status (enum: pending, approved, rejected)
### helpful_votes Table
- id (primary key)
- review_id (foreign key to reviews)
- user_id (foreign key to users)
- created_at (timestamp)
## Components to Implement
### RideReviewComponent
- Display review form
- Handle review submission
- Validate input
- Show success/error messages
### RideReviewListComponent
- Display reviews for a ride
- Pagination support
- Sorting options
- Helpful vote functionality
- Filter options (rating, date)
### ReviewModerationComponent
- Review queue for moderators
- Approve/reject functionality
- Edit capabilities
- Status tracking
## Features Required
1. Review Creation
- Rating input (1-5 stars)
- Title field (optional)
- Content field
- Client & server validation
- Anti-spam measures
2. Review Display
- List/grid view of reviews
- Sorting by date/rating
- Pagination
- Rating statistics
- Helpful vote system
3. Moderation System
- Review queue
- Approval workflow
- Edit capabilities
- Status management
- Moderation history
4. User Features
- One review per ride per user
- Edit own reviews
- Delete own reviews
- Vote on helpful reviews
5. Statistics
- Average rating calculation
- Rating distribution
- Review count tracking
- Helpful vote tallying
## Implementation Steps
1. Database Setup
- Create migrations
- Define models
- Set up relationships
- Add indexes
2. Models & Relations
- Review model
- HelpfulVote model
- Relationships to Ride and User
- Enum definitions
3. Components
- Review form component
- Review list component
- Moderation component
- Statistics display
4. Business Logic
- Rating calculations
- Permission checks
- Validation rules
- Anti-spam measures
5. Testing
- Unit tests
- Feature tests
- Integration tests
- User flow testing
## Security Considerations
1. Authorization
- User authentication required
- Rate limiting
- Moderation permissions
- Edit/delete permissions
2. Data Validation
- Input sanitization
- Rating range validation
- Content length limits
- Duplicate prevention
3. Anti-Abuse
- Rate limiting
- Spam detection
- Vote manipulation prevention
- Multiple account detection

View File

@@ -0,0 +1,169 @@
# Rides Management System
## Overview
The Rides Management System is a core feature that tracks and manages all rides within theme parks. This includes detailed information about individual rides, ride models, and specialized statistics for roller coasters.
## Models Structure
### RideModel
- Represents specific ride types/models that can be manufactured
- Belongs to a manufacturer
- Contains basic information like name, description, and category
- Used as a template for actual ride installations
### Ride
- Represents individual ride installations at parks
- Contains detailed operational information:
- Basic details (name, description, category)
- Location (park and park area)
- Manufacturer and designer details
- Operational status and dates
- Physical characteristics
- Performance metrics
- Maintains history tracking
- Supports photo attachments
- Connects to the review system
- Uses slug-based URLs
### RollerCoasterStats
- Extension for roller coaster specific details
- Tracks technical specifications:
- Physical dimensions (height, length, speed)
- Track characteristics
- Train configuration
- Operating specifications
## Database Schema
### ride_models table
```sql
CREATE TABLE ride_models (
id bigint PRIMARY KEY,
name varchar(255) NOT NULL,
manufacturer_id bigint NULL,
description text DEFAULT '',
category varchar(2) DEFAULT '',
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL
);
```
### rides table
```sql
CREATE TABLE rides (
id bigint PRIMARY KEY,
name varchar(255) NOT NULL,
slug varchar(255) NOT NULL,
description text DEFAULT '',
park_id bigint NOT NULL,
park_area_id bigint NULL,
category varchar(2) DEFAULT '',
manufacturer_id bigint NULL,
designer_id bigint NULL,
ride_model_id bigint NULL,
status varchar(20) DEFAULT 'OPERATING',
post_closing_status varchar(20) NULL,
opening_date date NULL,
closing_date date NULL,
status_since date NULL,
min_height_in integer NULL,
max_height_in integer NULL,
capacity_per_hour integer NULL,
ride_duration_seconds integer NULL,
average_rating decimal(3,2) NULL,
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL,
UNIQUE(park_id, slug)
);
```
### roller_coaster_stats table
```sql
CREATE TABLE roller_coaster_stats (
id bigint PRIMARY KEY,
ride_id bigint NOT NULL UNIQUE,
height_ft decimal(6,2) NULL,
length_ft decimal(7,2) NULL,
speed_mph decimal(5,2) NULL,
inversions integer DEFAULT 0,
ride_time_seconds integer NULL,
track_type varchar(255) DEFAULT '',
track_material varchar(20) DEFAULT 'STEEL',
roller_coaster_type varchar(20) DEFAULT 'SITDOWN',
max_drop_height_ft decimal(6,2) NULL,
launch_type varchar(20) DEFAULT 'CHAIN',
train_style varchar(255) DEFAULT '',
trains_count integer NULL,
cars_per_train integer NULL,
seats_per_car integer NULL
);
```
## Constants
### Ride Categories
- RC: Roller Coaster
- DR: Dark Ride
- FR: Flat Ride
- WR: Water Ride
- TR: Transport
- OT: Other
### Ride Statuses
- OPERATING: Operating
- CLOSED_TEMP: Temporarily Closed
- SBNO: Standing But Not Operating
- CLOSING: Closing
- CLOSED_PERM: Permanently Closed
- UNDER_CONSTRUCTION: Under Construction
- DEMOLISHED: Demolished
- RELOCATED: Relocated
### Track Materials
- STEEL: Steel
- WOOD: Wood
- HYBRID: Hybrid
### Roller Coaster Types
- SITDOWN: Sit Down
- INVERTED: Inverted
- FLYING: Flying
- STANDUP: Stand Up
- WING: Wing
- DIVE: Dive
- FAMILY: Family
- WILD_MOUSE: Wild Mouse
- SPINNING: Spinning
- FOURTH_DIMENSION: 4th Dimension
- OTHER: Other
### Launch Types
- CHAIN: Chain Lift
- LSM: LSM Launch
- HYDRAULIC: Hydraulic Launch
- GRAVITY: Gravity
- OTHER: Other
## Implementation Notes
### History Tracking
- Both Ride and RideModel use pghistory for tracking changes
- Changes are tracked in corresponding event tables
- Event models include display change methods for UI
### Relationships
- Rides belong to Parks and optionally to ParkAreas
- Rides can have a RideModel
- Rides can have a Manufacturer and Designer
- RideModels belong to Manufacturers
- Rides have polymorphic relationships with Photos and Reviews
### Laravel Implementation Plan
1. Create migrations for all tables
2. Create Enum classes for constants
3. Implement Models with relationships
4. Add history tracking support
5. Create Livewire components for CRUD operations
6. Implement views and forms
7. Add validation rules
8. Create factories and seeders for testing