From 95679c1067d88f28c5e7480d1abe94b735149e2e Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:50:25 +0000 Subject: [PATCH] Fix: Resolve type incompatibility in company person_type --- src/pages/DesignerDetail.tsx | 6 +++--- src/pages/ManufacturerDetail.tsx | 6 +++--- src/pages/ManufacturerModels.tsx | 8 ++++++-- src/pages/OperatorDetail.tsx | 8 ++++---- src/pages/PropertyOwnerDetail.tsx | 8 ++++---- src/types/database.ts | 2 +- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/pages/DesignerDetail.tsx b/src/pages/DesignerDetail.tsx index 85a6dc9b..ee8e55ea 100644 --- a/src/pages/DesignerDetail.tsx +++ b/src/pages/DesignerDetail.tsx @@ -341,9 +341,9 @@ export default function DesignerDetail() { name: designer.name, slug: designer.slug, description: designer.description, - company_type: 'designer', - person_type: designer.person_type, - website_url: designer.website_url, + company_type: 'designer', + person_type: (designer.person_type || 'company') as 'company' | 'individual' | 'firm' | 'organization', + website_url: designer.website_url, founded_year: designer.founded_year, headquarters_location: designer.headquarters_location, banner_image_url: designer.banner_image_url, diff --git a/src/pages/ManufacturerDetail.tsx b/src/pages/ManufacturerDetail.tsx index 2aa92c21..9b8c9939 100644 --- a/src/pages/ManufacturerDetail.tsx +++ b/src/pages/ManufacturerDetail.tsx @@ -375,9 +375,9 @@ export default function ManufacturerDetail() { name: manufacturer.name, slug: manufacturer.slug, description: manufacturer.description, - company_type: 'manufacturer', - person_type: manufacturer.person_type, - website_url: manufacturer.website_url, + company_type: 'manufacturer', + person_type: (manufacturer.person_type || 'company') as 'company' | 'individual' | 'firm' | 'organization', + website_url: manufacturer.website_url, founded_year: manufacturer.founded_year, headquarters_location: manufacturer.headquarters_location, banner_image_url: manufacturer.banner_image_url, diff --git a/src/pages/ManufacturerModels.tsx b/src/pages/ManufacturerModels.tsx index ed8a7169..cfe6200a 100644 --- a/src/pages/ManufacturerModels.tsx +++ b/src/pages/ManufacturerModels.tsx @@ -6,7 +6,7 @@ import { Badge } from '@/components/ui/badge'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { ArrowLeft, Filter, SlidersHorizontal, FerrisWheel, Plus } from 'lucide-react'; -import { RideModel, Company } from '@/types/database'; +import { RideModel, Company, Park } from '@/types/database'; import { RideModelSubmissionData } from '@/types/submission-data'; import { supabase } from '@/integrations/supabase/client'; import { RideModelCard } from '@/components/rides/RideModelCard'; @@ -16,6 +16,10 @@ import { useAuth } from '@/hooks/useAuth'; import { toast } from '@/hooks/use-toast'; import { useAuthModal } from '@/hooks/useAuthModal'; +interface RideModelWithCount extends RideModel { + ride_count: number; +} + export default function ManufacturerModels() { const { manufacturerSlug } = useParams<{ manufacturerSlug: string }>(); const navigate = useNavigate(); @@ -71,7 +75,7 @@ export default function ManufacturerModels() { const modelsWithCounts: RideModelWithCount[] = (modelsData || []).map(model => ({ ...model, ride_count: Array.isArray(model.rides) ? model.rides[0]?.count || 0 : 0 - })); + })) as RideModelWithCount[]; setModels(modelsWithCounts); } diff --git a/src/pages/OperatorDetail.tsx b/src/pages/OperatorDetail.tsx index 543650d2..f8995008 100644 --- a/src/pages/OperatorDetail.tsx +++ b/src/pages/OperatorDetail.tsx @@ -9,7 +9,7 @@ import { Card, CardContent } from '@/components/ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { ArrowLeft, MapPin, Star, Globe, Calendar, Edit, FerrisWheel, Gauge } from 'lucide-react'; -import { Company } from '@/types/database'; +import { Company, Park } from '@/types/database'; import { supabase } from '@/integrations/supabase/client'; import { OperatorForm } from '@/components/admin/OperatorForm'; import { OperatorPhotoGallery } from '@/components/companies/OperatorPhotoGallery'; @@ -427,9 +427,9 @@ export default function OperatorDetail() { name: operator.name, slug: operator.slug, description: operator.description, - company_type: 'operator', - person_type: operator.person_type, - website_url: operator.website_url, + company_type: 'operator', + person_type: (operator.person_type || 'company') as 'company' | 'individual' | 'firm' | 'organization', + website_url: operator.website_url, founded_year: operator.founded_year, headquarters_location: operator.headquarters_location, banner_image_url: operator.banner_image_url, diff --git a/src/pages/PropertyOwnerDetail.tsx b/src/pages/PropertyOwnerDetail.tsx index c32eda9e..e276512c 100644 --- a/src/pages/PropertyOwnerDetail.tsx +++ b/src/pages/PropertyOwnerDetail.tsx @@ -9,7 +9,7 @@ import { Card, CardContent } from '@/components/ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Dialog, DialogContent } from '@/components/ui/dialog'; import { ArrowLeft, MapPin, Star, Globe, Calendar, Edit, Building2, Gauge } from 'lucide-react'; -import { Company } from '@/types/database'; +import { Company, Park } from '@/types/database'; import { supabase } from '@/integrations/supabase/client'; import { PropertyOwnerForm } from '@/components/admin/PropertyOwnerForm'; import { PropertyOwnerPhotoGallery } from '@/components/companies/PropertyOwnerPhotoGallery'; @@ -427,9 +427,9 @@ export default function PropertyOwnerDetail() { name: owner.name, slug: owner.slug, description: owner.description, - company_type: 'property_owner', - person_type: owner.person_type, - website_url: owner.website_url, + company_type: 'property_owner', + person_type: (owner.person_type || 'company') as 'company' | 'individual' | 'firm' | 'organization', + website_url: owner.website_url, founded_year: owner.founded_year, headquarters_location: owner.headquarters_location, banner_image_url: owner.banner_image_url, diff --git a/src/types/database.ts b/src/types/database.ts index e105cb2d..32f501a5 100644 --- a/src/types/database.ts +++ b/src/types/database.ts @@ -16,7 +16,7 @@ export interface Company { slug: string; description?: string; company_type: string; // Allow any string from database - person_type: 'company' | 'individual' | 'firm' | 'organization'; + person_type?: string; // Database returns string, validated at form level website_url?: string; founded_year?: number; // Legacy field founded_date?: string;