mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-28 14:26:58 -05:00
Compare commits
2 Commits
fc7c2d5adc
...
9f5240ae95
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f5240ae95 | ||
|
|
9159b2ce89 |
@@ -43,6 +43,7 @@ const parkSchema = z.object({
|
||||
closing_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
||||
location: z.object({
|
||||
name: z.string(),
|
||||
street_address: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
state_province: z.string().optional(),
|
||||
country: z.string(),
|
||||
|
||||
@@ -101,6 +101,7 @@ export interface ParkFormData {
|
||||
// Location can be stored as object for new submissions or ID for editing
|
||||
location?: {
|
||||
name: string;
|
||||
street_address?: string;
|
||||
city?: string;
|
||||
state_province?: string;
|
||||
country: string;
|
||||
@@ -351,6 +352,7 @@ async function submitCompositeCreation(
|
||||
if (uploadedPrimary.type === 'park' && uploadedPrimary.data.location) {
|
||||
primaryData.temp_location_data = {
|
||||
name: uploadedPrimary.data.location.name,
|
||||
street_address: uploadedPrimary.data.location.street_address || null,
|
||||
city: uploadedPrimary.data.location.city || null,
|
||||
state_province: uploadedPrimary.data.location.state_province || null,
|
||||
country: uploadedPrimary.data.location.country,
|
||||
@@ -694,6 +696,7 @@ export async function submitParkCreation(
|
||||
// Insert into relational park_submissions table
|
||||
const tempLocationData = data.location ? {
|
||||
name: data.location.name,
|
||||
street_address: data.location.street_address || null,
|
||||
city: data.location.city || null,
|
||||
state_province: data.location.state_province || null,
|
||||
country: data.location.country,
|
||||
|
||||
@@ -712,6 +712,7 @@ async function resolveLocationId(locationData: any): Promise<string | null> {
|
||||
.from('locations')
|
||||
.insert({
|
||||
name: locationData.name,
|
||||
street_address: locationData.street_address || null,
|
||||
city: locationData.city || null,
|
||||
state_province: locationData.state_province || null,
|
||||
country: locationData.country,
|
||||
@@ -1477,6 +1478,7 @@ export async function editSubmissionItem(
|
||||
if (newData.location) {
|
||||
updateData.temp_location_data = {
|
||||
name: newData.location.name,
|
||||
street_address: newData.location.street_address || null,
|
||||
city: newData.location.city || null,
|
||||
state_province: newData.location.state_province || null,
|
||||
country: newData.location.country,
|
||||
|
||||
@@ -1556,6 +1556,7 @@ async function createPark(supabase: any, data: any): Promise<string> {
|
||||
.from('locations')
|
||||
.insert({
|
||||
name: data.temp_location_data.name,
|
||||
street_address: data.temp_location_data.street_address || null,
|
||||
city: data.temp_location_data.city,
|
||||
state_province: data.temp_location_data.state_province,
|
||||
country: data.temp_location_data.country,
|
||||
|
||||
Reference in New Issue
Block a user