From c323023e284d0aabe8bf0a81cca36f126607d5ec Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Sat, 21 Jun 2025 19:44:53 +0000
Subject: [PATCH] Run SQL to create tables and policies
This commit executes the provided SQL script to create the necessary tables (`faqs`, `faq_feedback`, `contatos`) and associated policies for the help system, as reviewed by the user. It also creates a storage bucket for contact form attachments.
---
src/components/help/ContactForm.tsx | 2 +-
src/components/help/FAQList.tsx | 6 +-
src/components/help/HelpIcon.tsx | 5 +-
src/integrations/supabase/types.ts | 92 +++++++++++++++++++
src/pages/AdminFAQ.tsx | 16 ++--
...4-7bb22206-ae6a-4729-bd06-63f2a5ab21bc.sql | 73 +++++++++++++++
6 files changed, 180 insertions(+), 14 deletions(-)
create mode 100644 supabase/migrations/20250621194224-7bb22206-ae6a-4729-bd06-63f2a5ab21bc.sql
diff --git a/src/components/help/ContactForm.tsx b/src/components/help/ContactForm.tsx
index fb86288..383e033 100644
--- a/src/components/help/ContactForm.tsx
+++ b/src/components/help/ContactForm.tsx
@@ -75,7 +75,7 @@ const ContactForm = ({ onBack }: ContactFormProps) => {
// Salvar contato no banco
const { error } = await supabase
- .from('contatos')
+ .from('contatos' as any)
.insert({
assunto: formData.assunto,
motivo: formData.motivo,
diff --git a/src/components/help/FAQList.tsx b/src/components/help/FAQList.tsx
index 7a2edd1..1605816 100644
--- a/src/components/help/FAQList.tsx
+++ b/src/components/help/FAQList.tsx
@@ -29,13 +29,13 @@ const FAQList = () => {
const loadFAQs = async () => {
try {
const { data, error } = await supabase
- .from('faqs')
+ .from('faqs' as any)
.select('*')
.eq('ativo', true)
.order('created_at', { ascending: false });
if (error) throw error;
- setFaqs(data || []);
+ setFaqs((data as FAQ[]) || []);
} catch (error) {
console.error('Erro ao carregar FAQs:', error);
toast({
@@ -61,7 +61,7 @@ const FAQList = () => {
const handleFeedback = async (faqId: string, helpful: boolean) => {
try {
const { error } = await supabase
- .from('faq_feedback')
+ .from('faq_feedback' as any)
.insert({
faq_id: faqId,
helpful: helpful,
diff --git a/src/components/help/HelpIcon.tsx b/src/components/help/HelpIcon.tsx
index d4772e8..7621fc9 100644
--- a/src/components/help/HelpIcon.tsx
+++ b/src/components/help/HelpIcon.tsx
@@ -20,10 +20,11 @@ const HelpIcon = () => {