mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 10:31:13 -05:00
Fix ride submission data loss
Implement the plan to fix critical data loss in ride submissions. This includes: - Storing ride technical specifications, coaster statistics, and name history in submission tables. - Adding missing category-specific fields to the `ride_submissions` table via a new migration. - Updating submission helpers and the edge function to include these new fields. - Fixing the park location Zod schema to include `street_address`.
This commit is contained in:
@@ -864,7 +864,40 @@ serve(withRateLimit(async (req) => {
|
||||
case 'ride':
|
||||
itemData = {
|
||||
...(item as any).ride_submission,
|
||||
...(tempRefsByItemId.get(item.id) || {})
|
||||
...(tempRefsByItemId.get(item.id) || {}),
|
||||
// Ensure all category-specific fields are included
|
||||
track_material: (item as any).ride_submission?.track_material,
|
||||
support_material: (item as any).ride_submission?.support_material,
|
||||
propulsion_method: (item as any).ride_submission?.propulsion_method,
|
||||
water_depth_cm: (item as any).ride_submission?.water_depth_cm,
|
||||
splash_height_meters: (item as any).ride_submission?.splash_height_meters,
|
||||
wetness_level: (item as any).ride_submission?.wetness_level,
|
||||
flume_type: (item as any).ride_submission?.flume_type,
|
||||
boat_capacity: (item as any).ride_submission?.boat_capacity,
|
||||
theme_name: (item as any).ride_submission?.theme_name,
|
||||
story_description: (item as any).ride_submission?.story_description,
|
||||
show_duration_seconds: (item as any).ride_submission?.show_duration_seconds,
|
||||
animatronics_count: (item as any).ride_submission?.animatronics_count,
|
||||
projection_type: (item as any).ride_submission?.projection_type,
|
||||
ride_system: (item as any).ride_submission?.ride_system,
|
||||
scenes_count: (item as any).ride_submission?.scenes_count,
|
||||
rotation_type: (item as any).ride_submission?.rotation_type,
|
||||
motion_pattern: (item as any).ride_submission?.motion_pattern,
|
||||
platform_count: (item as any).ride_submission?.platform_count,
|
||||
swing_angle_degrees: (item as any).ride_submission?.swing_angle_degrees,
|
||||
rotation_speed_rpm: (item as any).ride_submission?.rotation_speed_rpm,
|
||||
arm_length_meters: (item as any).ride_submission?.arm_length_meters,
|
||||
max_height_reached_meters: (item as any).ride_submission?.max_height_reached_meters,
|
||||
min_age: (item as any).ride_submission?.min_age,
|
||||
max_age: (item as any).ride_submission?.max_age,
|
||||
educational_theme: (item as any).ride_submission?.educational_theme,
|
||||
character_theme: (item as any).ride_submission?.character_theme,
|
||||
transport_type: (item as any).ride_submission?.transport_type,
|
||||
route_length_meters: (item as any).ride_submission?.route_length_meters,
|
||||
stations_count: (item as any).ride_submission?.stations_count,
|
||||
vehicle_capacity: (item as any).ride_submission?.vehicle_capacity,
|
||||
vehicles_count: (item as any).ride_submission?.vehicles_count,
|
||||
round_trip_duration_seconds: (item as any).ride_submission?.round_trip_duration_seconds
|
||||
};
|
||||
break;
|
||||
case 'manufacturer':
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
-- Add missing category-specific fields to ride_submissions table
|
||||
-- This ensures all ride category data can flow through the submission pipeline
|
||||
|
||||
ALTER TABLE ride_submissions
|
||||
ADD COLUMN IF NOT EXISTS track_material TEXT[],
|
||||
ADD COLUMN IF NOT EXISTS support_material TEXT[],
|
||||
ADD COLUMN IF NOT EXISTS propulsion_method TEXT[],
|
||||
-- Water ride fields
|
||||
ADD COLUMN IF NOT EXISTS water_depth_cm INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS splash_height_meters NUMERIC,
|
||||
ADD COLUMN IF NOT EXISTS wetness_level TEXT,
|
||||
ADD COLUMN IF NOT EXISTS flume_type TEXT,
|
||||
ADD COLUMN IF NOT EXISTS boat_capacity INTEGER,
|
||||
-- Dark ride fields
|
||||
ADD COLUMN IF NOT EXISTS theme_name TEXT,
|
||||
ADD COLUMN IF NOT EXISTS story_description TEXT,
|
||||
ADD COLUMN IF NOT EXISTS show_duration_seconds INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS animatronics_count INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS projection_type TEXT,
|
||||
ADD COLUMN IF NOT EXISTS ride_system TEXT,
|
||||
ADD COLUMN IF NOT EXISTS scenes_count INTEGER,
|
||||
-- Flat ride fields
|
||||
ADD COLUMN IF NOT EXISTS rotation_type TEXT,
|
||||
ADD COLUMN IF NOT EXISTS motion_pattern TEXT,
|
||||
ADD COLUMN IF NOT EXISTS platform_count INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS swing_angle_degrees NUMERIC,
|
||||
ADD COLUMN IF NOT EXISTS rotation_speed_rpm NUMERIC,
|
||||
ADD COLUMN IF NOT EXISTS arm_length_meters NUMERIC,
|
||||
ADD COLUMN IF NOT EXISTS max_height_reached_meters NUMERIC,
|
||||
-- Kiddie ride fields
|
||||
ADD COLUMN IF NOT EXISTS min_age INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS max_age INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS educational_theme TEXT,
|
||||
ADD COLUMN IF NOT EXISTS character_theme TEXT,
|
||||
-- Transportation ride fields
|
||||
ADD COLUMN IF NOT EXISTS transport_type TEXT,
|
||||
ADD COLUMN IF NOT EXISTS route_length_meters NUMERIC,
|
||||
ADD COLUMN IF NOT EXISTS stations_count INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS vehicle_capacity INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS vehicles_count INTEGER,
|
||||
ADD COLUMN IF NOT EXISTS round_trip_duration_seconds INTEGER;
|
||||
|
||||
COMMENT ON TABLE ride_submissions IS 'Submission data for rides - includes all category-specific fields to prevent data loss during moderation';
|
||||
Reference in New Issue
Block a user