basejump
                                
                                 basejump copied to clipboard
                                
                                    basejump copied to clipboard
                            
                            
                            
                        how to delete a team account?
I couldn't find the API to delete a team account on base jump docs. Please help me out.
1. Add new policy on basejump.accounts
"Account can be deleted by primary owner" with check " (primary_owner_user_id = auth.uid())"
2. Expose basejump scheme from API
Go to settings -> Api -> Exposed schema and add basejump here
!! Warning, make sure your policies are correct. I did only a brief check and it seems basejump has sane defaults, but the risk is on you.
3. Query from client using basejump and not public schema
      const { data, error } = await supabase
        .schema("basejump")
        .from("accounts")
        .delete()
        .eq("id", workspaceId);
We do not wish to expose the entire basejump schema public as mentioned above.
Is there a function / rest api to delete the team?
@airsherlock I think you'd have to write the function yourself.
Something like this:
**
  Allows an owner to delete an existing account
 */
create or replace function public.delete_account(account_id uuid)
    returns void
    language plpgsql
as
$$
begin
    -- verify account owner for the account
    if basejump.has_role_on_account(
               delete_account.account_id, 'owner') <>
       true then
        raise exception 'Only account owners can delete accounts';
    end if;
    delete from basejump.accounts where id = delete_account.account_id;
end
$$;
grant execute on function public.delete_account(uuid) to authenticated;