Fix: Approve database migration

This commit is contained in:
gpt-engineer-app[bot]
2025-10-17 14:40:48 +00:00
parent 0db54b402b
commit 4ab59e2ec2
29 changed files with 180 additions and 112 deletions

View File

@@ -10,6 +10,7 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/com
import { Label } from '@/components/ui/label';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
import { getErrorMessage } from '@/lib/errorHandler';
export default function AuthCallback() {
const navigate = useNavigate();
@@ -124,14 +125,15 @@ export default function AuthCallback() {
navigate('/');
}, 500);
} catch (error: any) {
console.error('[AuthCallback] Error:', error);
} catch (error) {
const errorMsg = getErrorMessage(error);
console.error('[AuthCallback] Error:', errorMsg);
setStatus('error');
toast({
variant: 'destructive',
title: 'Sign in error',
description: error.message || 'An error occurred during sign in. Please try again.',
description: errorMsg,
});
// Redirect to auth page after error
@@ -183,12 +185,13 @@ export default function AuthCallback() {
navigate('/auth');
}, 1500);
} catch (error: any) {
console.error('[AuthCallback] Password reset error:', error);
} catch (error) {
const errorMsg = getErrorMessage(error);
console.error('[AuthCallback] Password reset error:', errorMsg);
toast({
variant: 'destructive',
title: 'Failed to set password',
description: error.message || 'Please try again.',
description: errorMsg,
});
setSettingPassword(false);
}

View File

@@ -15,6 +15,7 @@ import { DesignerPhotoGallery } from '@/components/companies/DesignerPhotoGaller
import { useAuth } from '@/hooks/useAuth';
import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
import { VersionIndicator } from '@/components/versioning/VersionIndicator';
import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs';
@@ -109,10 +110,11 @@ export default function DesignerDetail() {
});
setIsEditModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit edit.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -16,6 +16,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyCreation } from '@/lib/companyHelpers';
import { useAuthModal } from '@/hooks/useAuthModal';
import { getErrorMessage } from '@/lib/errorHandler';
export default function Designers() {
const navigate = useNavigate();
@@ -36,8 +37,9 @@ export default function Designers() {
description: "Your submission has been sent for review."
});
setIsCreateModalOpen(false);
} catch (error: any) {
toast({ title: "Error", description: error.message || "Failed to submit designer.", variant: "destructive" });
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({ title: "Error", description: errorMsg, variant: "destructive" });
}
};

View File

@@ -16,6 +16,7 @@ import { ManufacturerPhotoGallery } from '@/components/companies/ManufacturerPho
import { useAuth } from '@/hooks/useAuth';
import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
import { VersionIndicator } from '@/components/versioning/VersionIndicator';
import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs';
@@ -119,10 +120,11 @@ export default function ManufacturerDetail() {
});
setIsEditModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit edit.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -16,6 +16,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyCreation } from '@/lib/companyHelpers';
import { useAuthModal } from '@/hooks/useAuthModal';
import { getErrorMessage } from '@/lib/errorHandler';
export default function Manufacturers() {
const navigate = useNavigate();
@@ -80,10 +81,11 @@ export default function Manufacturers() {
});
setIsCreateModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit manufacturer.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -17,6 +17,7 @@ import { ParkCard } from '@/components/parks/ParkCard';
import { useAuth } from '@/hooks/useAuth';
import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
import { VersionIndicator } from '@/components/versioning/VersionIndicator';
import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs';
@@ -154,10 +155,11 @@ export default function OperatorDetail() {
});
setIsEditModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit edit.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -17,6 +17,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyCreation } from '@/lib/companyHelpers';
import { useAuthModal } from '@/hooks/useAuthModal';
import { getErrorMessage } from '@/lib/errorHandler';
const Operators = () => {
const navigate = useNavigate();
@@ -73,10 +74,11 @@ const Operators = () => {
});
setIsCreateModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit operator.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -20,6 +20,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } f
import { RideForm } from '@/components/admin/RideForm';
import { ParkForm } from '@/components/admin/ParkForm';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { useUserRole } from '@/hooks/useUserRole';
import { Edit } from 'lucide-react';
import { VersionIndicator } from '@/components/versioning/VersionIndicator';
@@ -149,10 +150,11 @@ export default function ParkDetail() {
});
setIsAddRideModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Submission Failed",
description: error.message || "Failed to submit ride for review.",
description: errorMsg,
variant: "destructive"
});
}
@@ -175,10 +177,11 @@ export default function ParkDetail() {
});
setIsEditParkModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit park edit.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -17,6 +17,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyCreation } from '@/lib/companyHelpers';
import { useAuthModal } from '@/hooks/useAuthModal';
import { getErrorMessage } from '@/lib/errorHandler';
const ParkOwners = () => {
const navigate = useNavigate();
@@ -73,10 +74,11 @@ const ParkOwners = () => {
});
setIsCreateModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: error.message || "Failed to submit property owner.",
description: errorMsg,
variant: "destructive"
});
}

View File

@@ -14,6 +14,7 @@ import { RideSubmissionData } from '@/types/submission-data';
import { supabase } from '@/integrations/supabase/client';
import { useAuth } from '@/hooks/useAuth';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { useAuthModal } from '@/hooks/useAuthModal';
export default function ParkRides() {
@@ -130,10 +131,11 @@ export default function ParkRides() {
});
setIsCreateModalOpen(false);
} catch (error: any) {
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Submission Failed",
description: error.message || "Failed to submit ride.",
description: errorMsg,
variant: "destructive"
});
}