Fix: Remove SECURITY DEFINER views

This commit is contained in:
gpt-engineer-app[bot]
2025-10-08 22:34:05 +00:00
parent ee4f81b99b
commit 72bfa69139
4 changed files with 100 additions and 12 deletions

View File

@@ -46,6 +46,28 @@ const designerSchema = z.object({
type DesignerFormData = z.infer<typeof designerSchema>;
// Input type for the form (before transformation)
type DesignerFormInput = {
name: string;
slug: string;
description?: string;
person_type: 'company' | 'individual' | 'firm' | 'organization';
website_url?: string;
founded_year?: string;
headquarters_location?: string;
images?: {
uploaded: Array<{
url: string;
cloudflare_id?: string;
file?: any;
isLocal?: boolean;
caption?: string;
}>;
banner_assignment?: number | null;
card_assignment?: number | null;
};
};
interface DesignerFormProps {
onSubmit: (data: DesignerFormData) => void;
onCancel: () => void;
@@ -66,7 +88,7 @@ export function DesignerForm({ onSubmit, onCancel, initialData }: DesignerFormPr
setValue,
watch,
formState: { errors }
} = useForm<DesignerFormData>({
} = useForm<DesignerFormInput>({
resolver: zodResolver(designerSchema),
defaultValues: {
name: initialData?.name || '',
@@ -77,7 +99,7 @@ export function DesignerForm({ onSubmit, onCancel, initialData }: DesignerFormPr
founded_year: initialData?.founded_year ? String(initialData.founded_year) : '',
headquarters_location: initialData?.headquarters_location || '',
images: initialData?.images || { uploaded: [] }
} as Partial<DesignerFormData>
}
});
@@ -90,7 +112,7 @@ export function DesignerForm({ onSubmit, onCancel, initialData }: DesignerFormPr
</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
<form onSubmit={handleSubmit((data) => onSubmit(data as unknown as DesignerFormData))} className="space-y-6">
{/* Basic Information */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">