Skip to main content

recompute_draft_invoice

PostgREST stored procedure — POST /rest/v1/rpc/recompute_draft_invoice.

These are SECURITY DEFINER functions granted only to the service role (execute is revoked from anon/authenticated). They bypass table RLS and enforce their own company_id and status checks internally, so call them server-side with the service-role key:

const { data, error } = await supabase.rpc('recompute_draft_invoice', { p_actor, p_company_id, p_invoice_id, p_lines, p_total_cents, p_variance_flagged });

Arguments

ArgumentTypeRequired
p_actoruuidyes
p_company_iduuidyes
p_invoice_iduuidyes
p_linesjsonbyes
p_total_centsbigintyes
p_variance_flaggedbooleanyes

Generated from specs/supabase.json. The function's behaviour is defined by its SQL migration; this page documents its call signature only.