mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 18:11:12 -05:00
Fix type safety and field names
This commit is contained in:
@@ -10,6 +10,7 @@ import { AutocompleteSearch } from '@/components/search/AutocompleteSearch';
|
||||
import { RideCard } from '@/components/rides/RideCard';
|
||||
import { RideForm } from '@/components/admin/RideForm';
|
||||
import { Ride, Park } from '@/types/database';
|
||||
import { RideSubmissionData } from '@/types/submission-data';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { toast } from '@/hooks/use-toast';
|
||||
@@ -83,9 +84,9 @@ export default function ParkRides() {
|
||||
case 'speed':
|
||||
query = query.order('max_speed_kmh', { ascending: false, nullsFirst: false });
|
||||
break;
|
||||
case 'height':
|
||||
query = query.order('height_meters', { ascending: false, nullsFirst: false });
|
||||
break;
|
||||
case 'height':
|
||||
query = query.order('max_height_meters', { ascending: false, nullsFirst: false });
|
||||
break;
|
||||
case 'reviews':
|
||||
query = query.order('review_count', { ascending: false });
|
||||
break;
|
||||
@@ -110,7 +111,7 @@ export default function ParkRides() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleCreateSubmit = async (data: any) => {
|
||||
const handleCreateSubmit = async (data: Omit<RideSubmissionData, 'park_id'> & { park_id?: string }) => {
|
||||
try {
|
||||
if (!user) {
|
||||
navigate('/auth');
|
||||
@@ -118,10 +119,10 @@ export default function ParkRides() {
|
||||
}
|
||||
|
||||
// Pre-fill park_id in the submission
|
||||
const submissionData = {
|
||||
...data,
|
||||
park_id: park?.id,
|
||||
};
|
||||
const submissionData = {
|
||||
...data,
|
||||
park_id: park.id,
|
||||
};
|
||||
|
||||
const { submitRideCreation } = await import('@/lib/entitySubmissionHelpers');
|
||||
await submitRideCreation(submissionData, user.id);
|
||||
|
||||
Reference in New Issue
Block a user