Fix: Resolve type incompatibility in company person_type

This commit is contained in:
gpt-engineer-app[bot]
2025-10-16 13:50:25 +00:00
parent 4efdeaa104
commit 95679c1067
6 changed files with 21 additions and 17 deletions

View File

@@ -342,7 +342,7 @@ export default function DesignerDetail() {
slug: designer.slug,
description: designer.description,
company_type: 'designer',
person_type: designer.person_type,
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,

View File

@@ -376,7 +376,7 @@ export default function ManufacturerDetail() {
slug: manufacturer.slug,
description: manufacturer.description,
company_type: 'manufacturer',
person_type: manufacturer.person_type,
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,

View File

@@ -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);
}

View File

@@ -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';
@@ -428,7 +428,7 @@ export default function OperatorDetail() {
slug: operator.slug,
description: operator.description,
company_type: 'operator',
person_type: operator.person_type,
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,

View File

@@ -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';
@@ -428,7 +428,7 @@ export default function PropertyOwnerDetail() {
slug: owner.slug,
description: owner.description,
company_type: 'property_owner',
person_type: owner.person_type,
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,

View File

@@ -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;