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">

View File

@@ -46,6 +46,28 @@ const manufacturerSchema = z.object({
type ManufacturerFormData = z.infer<typeof manufacturerSchema>;
// Input type for the form (before transformation)
type ManufacturerFormInput = {
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 ManufacturerFormProps {
onSubmit: (data: ManufacturerFormData) => void;
onCancel: () => void;
@@ -66,7 +88,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
setValue,
watch,
formState: { errors }
} = useForm<ManufacturerFormData>({
} = useForm<ManufacturerFormInput>({
resolver: zodResolver(manufacturerSchema),
defaultValues: {
name: initialData?.name || '',
@@ -77,7 +99,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
founded_year: initialData?.founded_year ? String(initialData.founded_year) : '',
headquarters_location: initialData?.headquarters_location || '',
images: initialData?.images || { uploaded: [] }
} as Partial<ManufacturerFormData>
}
});
@@ -90,7 +112,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
<form onSubmit={handleSubmit((data) => onSubmit(data as unknown as ManufacturerFormData))} className="space-y-6">
{/* Basic Information */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">

View File

@@ -46,6 +46,28 @@ const operatorSchema = z.object({
type OperatorFormData = z.infer<typeof operatorSchema>;
// Input type for the form (before transformation)
type OperatorFormInput = {
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 OperatorFormProps {
onSubmit: (data: OperatorFormData) => void;
onCancel: () => void;
@@ -66,7 +88,7 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
setValue,
watch,
formState: { errors }
} = useForm<OperatorFormData>({
} = useForm<OperatorFormInput>({
resolver: zodResolver(operatorSchema),
defaultValues: {
name: initialData?.name || '',
@@ -77,7 +99,7 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
founded_year: initialData?.founded_year ? String(initialData.founded_year) : '',
headquarters_location: initialData?.headquarters_location || '',
images: initialData?.images || { uploaded: [] }
} as Partial<OperatorFormData>
}
});
@@ -90,7 +112,7 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
<form onSubmit={handleSubmit((data) => onSubmit(data as unknown as OperatorFormData))} className="space-y-6">
{/* Basic Information */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">

View File

@@ -46,6 +46,28 @@ const propertyOwnerSchema = z.object({
type PropertyOwnerFormData = z.infer<typeof propertyOwnerSchema>;
// Input type for the form (before transformation)
type PropertyOwnerFormInput = {
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 PropertyOwnerFormProps {
onSubmit: (data: PropertyOwnerFormData) => void;
onCancel: () => void;
@@ -66,7 +88,7 @@ export function PropertyOwnerForm({ onSubmit, onCancel, initialData }: PropertyO
setValue,
watch,
formState: { errors }
} = useForm<PropertyOwnerFormData>({
} = useForm<PropertyOwnerFormInput>({
resolver: zodResolver(propertyOwnerSchema),
defaultValues: {
name: initialData?.name || '',
@@ -77,7 +99,7 @@ export function PropertyOwnerForm({ onSubmit, onCancel, initialData }: PropertyO
founded_year: initialData?.founded_year ? String(initialData.founded_year) : '',
headquarters_location: initialData?.headquarters_location || '',
images: initialData?.images || { uploaded: [] }
} as Partial<PropertyOwnerFormData>
}
});
@@ -90,7 +112,7 @@ export function PropertyOwnerForm({ onSubmit, onCancel, initialData }: PropertyO
</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
<form onSubmit={handleSubmit((data) => onSubmit(data as unknown as PropertyOwnerFormData))} className="space-y-6">
{/* Basic Information */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">