mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 08:11:12 -05:00
Fix park submission locations
Implement Phase 1 of the JSONB violation fix by creating the `park_submission_locations` table. This includes migrating existing data from `park_submissions.temp_location_data` and updating relevant code to read and write to the new relational table. The `temp_location_data` column will be dropped after data migration.
This commit is contained in:
@@ -32,9 +32,14 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
.single();
|
||||
setLocation(locationData);
|
||||
}
|
||||
// Otherwise use temp_location_data (for new submissions)
|
||||
else if (data.temp_location_data) {
|
||||
setLocation(data.temp_location_data);
|
||||
// Otherwise fetch from park_submission_locations (for new submissions)
|
||||
else if (data.id) {
|
||||
const { data: locationData } = await supabase
|
||||
.from('park_submission_locations')
|
||||
.select('*')
|
||||
.eq('park_submission_id', data.id)
|
||||
.maybeSingle();
|
||||
setLocation(locationData);
|
||||
}
|
||||
|
||||
// Fetch operator
|
||||
@@ -59,7 +64,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
};
|
||||
|
||||
fetchRelatedData();
|
||||
}, [data.location_id, data.temp_location_data, data.operator_id, data.property_owner_id]);
|
||||
}, [data.location_id, data.id, data.operator_id, data.property_owner_id]);
|
||||
|
||||
const getStatusColor = (status: string | undefined) => {
|
||||
if (!status) return 'bg-gray-500';
|
||||
|
||||
Reference in New Issue
Block a user