budget-view-finance/supabase/functions/update-register-function-sql/index.ts
gpt-engineer-app[bot] d304d5c9c6 Fix: Add WhatsApp to registration form type
The `RegisterForm.tsx` component was updated to include a WhatsApp field. The TypeScript error was resolved by adding the `whatsapp` property to the type definition used for the registration form data. This ensures that the object literal used to pass data to the `supabase.rpc('registrar_usuario')` function includes the `whatsapp` field, resolving the type error.
2025-05-23 16:15:10 +00:00

28 lines
746 B
TypeScript

// This is a temporary solution to update the database function
// You can run this SQL in the Supabase SQL Editor:
//
// CREATE OR REPLACE FUNCTION public.registrar_usuario(
// nome text,
// empresa text,
// email text,
// senha text,
// whatsapp text
// ) RETURNS uuid
// LANGUAGE plpgsql
// SECURITY DEFINER
// AS $function$
// DECLARE
// novo_usuario_id UUID;
// BEGIN
// -- Inserir novo usuário com senha hash
// INSERT INTO public.usuarios (nome, empresa, email, senha, whatsapp)
// VALUES (nome, empresa, email, crypt(senha, gen_salt('bf')), whatsapp)
// RETURNING id INTO novo_usuario_id;
//
// -- Retorna o ID do usuário criado sem criar tabela individual
// RETURN novo_usuario_id;
// END;
// $function$