mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 03:51: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 { RideCard } from '@/components/rides/RideCard';
|
||||||
import { RideForm } from '@/components/admin/RideForm';
|
import { RideForm } from '@/components/admin/RideForm';
|
||||||
import { Ride, Park } from '@/types/database';
|
import { Ride, Park } from '@/types/database';
|
||||||
|
import { RideSubmissionData } from '@/types/submission-data';
|
||||||
import { supabase } from '@/integrations/supabase/client';
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
import { useAuth } from '@/hooks/useAuth';
|
import { useAuth } from '@/hooks/useAuth';
|
||||||
import { toast } from '@/hooks/use-toast';
|
import { toast } from '@/hooks/use-toast';
|
||||||
@@ -83,9 +84,9 @@ export default function ParkRides() {
|
|||||||
case 'speed':
|
case 'speed':
|
||||||
query = query.order('max_speed_kmh', { ascending: false, nullsFirst: false });
|
query = query.order('max_speed_kmh', { ascending: false, nullsFirst: false });
|
||||||
break;
|
break;
|
||||||
case 'height':
|
case 'height':
|
||||||
query = query.order('height_meters', { ascending: false, nullsFirst: false });
|
query = query.order('max_height_meters', { ascending: false, nullsFirst: false });
|
||||||
break;
|
break;
|
||||||
case 'reviews':
|
case 'reviews':
|
||||||
query = query.order('review_count', { ascending: false });
|
query = query.order('review_count', { ascending: false });
|
||||||
break;
|
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 {
|
try {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
navigate('/auth');
|
navigate('/auth');
|
||||||
@@ -118,10 +119,10 @@ export default function ParkRides() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pre-fill park_id in the submission
|
// Pre-fill park_id in the submission
|
||||||
const submissionData = {
|
const submissionData = {
|
||||||
...data,
|
...data,
|
||||||
park_id: park?.id,
|
park_id: park.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { submitRideCreation } = await import('@/lib/entitySubmissionHelpers');
|
const { submitRideCreation } = await import('@/lib/entitySubmissionHelpers');
|
||||||
await submitRideCreation(submissionData, user.id);
|
await submitRideCreation(submissionData, user.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user