Fix composite submission location

This commit is contained in:
gpt-engineer-app[bot]
2025-11-06 01:44:28 +00:00
parent ceeb41768f
commit 20f3844a58
2 changed files with 262 additions and 0 deletions

View File

@@ -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-')) {