mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 17:31:13 -05:00
Fix composite submission location
This commit is contained in:
@@ -347,6 +347,23 @@ async function submitCompositeCreation(
|
||||
images: primaryImages as unknown as Json
|
||||
};
|
||||
|
||||
// Convert location object to temp_location_data for parks
|
||||
if (uploadedPrimary.type === 'park' && uploadedPrimary.data.location) {
|
||||
primaryData.temp_location_data = {
|
||||
name: uploadedPrimary.data.location.name,
|
||||
city: uploadedPrimary.data.location.city || null,
|
||||
state_province: uploadedPrimary.data.location.state_province || null,
|
||||
country: uploadedPrimary.data.location.country,
|
||||
latitude: uploadedPrimary.data.location.latitude,
|
||||
longitude: uploadedPrimary.data.location.longitude,
|
||||
timezone: uploadedPrimary.data.location.timezone || null,
|
||||
postal_code: uploadedPrimary.data.location.postal_code || null,
|
||||
display_name: uploadedPrimary.data.location.display_name
|
||||
};
|
||||
delete primaryData.location; // Remove the original location object
|
||||
console.log('[submitCompositeCreation] Converted location to temp_location_data:', primaryData.temp_location_data);
|
||||
}
|
||||
|
||||
// Map temporary IDs to order indices for foreign keys
|
||||
if (uploadedPrimary.type === 'park') {
|
||||
if (uploadedPrimary.data.operator_id?.startsWith('temp-')) {
|
||||
|
||||
Reference in New Issue
Block a user