00ae3540db
* feat(customers): carry contact person and invoice copy recipients through migration Extends the arcim-migration entity mapper, Fortnox provider mapper, canonical DTOs, customer APIs (web + v1) and invoice send flows so contact person and customer-level invoice CC/BCC addresses survive provider migrations. NULL means unconfigured and empty means an explicit clear, so re-syncs enrich legacy gaps without resurrecting deliberately removed values. Fortnox fixed assets are split into a dedicated follow-up issue. Fixes #1345 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(db): bump customer metadata migration past pack-slug version Main already contains 20260803230000; keep new versions strictly newest so Supabase branching applies them in order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(customers): complete Customer type consumers and make enrichment payload resolvable The preview-pdf mock customer and the makeCustomer fixture now carry the three new metadata fields, fixing the type-check failure in Build (zero extensions) and Vercel. The enrichment update in the migration orchestrator now spells its payload as an object literal typed CustomerMetadataEnrichment (absent keys drop at serialization), so the phantom-column guard resolves the columns instead of counting another unresolvable dynamic payload past its ceiling. The cc/bcc guards also verify element types instead of casting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
27 lines
1.3 KiB
SQL
27 lines
1.3 KiB
SQL
-- Customer-level invoice delivery metadata carried by provider migrations.
|
|
-- NULL means the provider/user has not configured the field; an empty array
|
|
-- is an explicit "no copy recipients" choice and must survive re-syncs.
|
|
ALTER TABLE public.customers
|
|
ADD COLUMN contact_person text,
|
|
ADD COLUMN invoice_email_cc_addresses text[],
|
|
ADD COLUMN invoice_email_bcc_addresses text[];
|
|
|
|
ALTER TABLE public.customers
|
|
ADD CONSTRAINT customers_contact_person_length_check
|
|
CHECK (contact_person IS NULL OR char_length(contact_person) <= 200),
|
|
ADD CONSTRAINT customers_invoice_email_copy_recipient_limit_check
|
|
CHECK (
|
|
cardinality(COALESCE(invoice_email_cc_addresses, '{}'::text[]))
|
|
+ cardinality(COALESCE(invoice_email_bcc_addresses, '{}'::text[]))
|
|
<= 19
|
|
);
|
|
|
|
COMMENT ON COLUMN public.customers.contact_person IS
|
|
'Customer contact/reference person used by provider migrations and invoicing.';
|
|
COMMENT ON COLUMN public.customers.invoice_email_cc_addresses IS
|
|
'Customer-specific invoice CC recipients. NULL means unconfigured; empty means explicitly none.';
|
|
COMMENT ON COLUMN public.customers.invoice_email_bcc_addresses IS
|
|
'Customer-specific invoice BCC recipients. NULL means unconfigured; empty means explicitly none.';
|
|
|
|
NOTIFY pgrst, 'reload schema';
|