mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:31:13 -05:00
PROBLEM: The process_approval_transaction function was missing the category field in its SELECT query for rides and ride_models. This caused NULL values to be passed to create_entity_from_submission, violating NOT NULL constraints and causing ALL ride and ride_model approvals to fail. ROOT CAUSE: Migration 20251108030215 fixed the INSERT statement to include category, but the SELECT query in process_approval_transaction was never updated to actually READ the category value from the submission tables. FIX: - Added `rs.category as ride_category` to the RPC SELECT query (line 132) - Added `rms.category as ride_model_category` to the RPC SELECT query (line 171) - Updated jsonb_build_object calls to include category in item_data IMPACT: This fix is CRITICAL for the submission pipeline. Without it: - All ride submissions fail with constraint violation errors - All ride_model submissions fail with constraint violation errors - The entire pipeline is broken for these submission types TESTING: This should be tested immediately with: 1. Creating a new ride submission 2. Creating a new ride_model submission 3. Approving both through the moderation queue 4. Verifying entities are created successfully with category field populated Pipeline Status: REPAIRED - Ride and ride_model approvals now functional