fix: crash bugs in TeamInvoices + faster load
Bug fixes: - TeamInvoices: add useAuth import/currentUser (invoice-create crash) - TeamInvoices: setChartYear -> setExportYear (year-dropdown crash) - TeamDashboard: drop redundant setState-in-effect (cascading renders) - Companies: delete dead _UnusedClientCompanies (illegal hook calls) - annotate intentional empty PDF-fallback catches Load speed: - preconnect/dns-prefetch to Supabase origin - lazy-load heic-to in Converters: page chunk 2737KB -> 9KB - split recharts into its own 'charts' vendor chunk Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
-- Prevent deletion of paid client invoices for all roles.
|
||||
create or replace function public.prevent_paid_invoice_delete()
|
||||
returns trigger
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
if old.status = 'paid' then
|
||||
raise exception 'Paid invoices cannot be deleted.';
|
||||
end if;
|
||||
return old;
|
||||
end;
|
||||
$$;
|
||||
|
||||
drop trigger if exists prevent_paid_invoice_delete on public.invoices;
|
||||
|
||||
create trigger prevent_paid_invoice_delete
|
||||
before delete on public.invoices
|
||||
for each row
|
||||
execute function public.prevent_paid_invoice_delete();
|
||||
Reference in New Issue
Block a user