feat(customers): carry contact person and invoice copy recipients through migration (#1392)
* 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>
This commit is contained in:
co-authored by
Claude Fable 5
parent
cb3ef45f14
commit
00ae3540db
@@ -629,6 +629,9 @@ describe('CreateCustomerSchema', () => {
|
||||
const result = CreateCustomerSchema.safeParse(validCustomer({
|
||||
email: 'billing@acme.se',
|
||||
phone: '+46701234567',
|
||||
contact_person: 'Anna Andersson',
|
||||
invoice_email_cc_addresses: ['finance@acme.se'],
|
||||
invoice_email_bcc_addresses: ['archive@acme.se'],
|
||||
address_line1: 'Storgatan 1',
|
||||
address_line2: 'Box 123',
|
||||
postal_code: '111 22',
|
||||
@@ -682,6 +685,20 @@ describe('CreateCustomerSchema', () => {
|
||||
const result = CreateCustomerSchema.safeParse(validCustomer({ default_payment_terms: 30.5 }))
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects more than 19 customer invoice copy recipients across CC and BCC', () => {
|
||||
const result = CreateCustomerSchema.safeParse(validCustomer({
|
||||
invoice_email_cc_addresses: Array.from(
|
||||
{ length: 10 },
|
||||
(_, index) => `copy-${index}@example.test`,
|
||||
),
|
||||
invoice_email_bcc_addresses: Array.from(
|
||||
{ length: 10 },
|
||||
(_, index) => `archive-${index}@example.test`,
|
||||
),
|
||||
}))
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
// ============================================================
|
||||
@@ -2149,6 +2166,13 @@ describe('UpdateCustomerSchema', () => {
|
||||
const result = UpdateCustomerSchema.safeParse({ customer_type: 'government' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects an invalid customer invoice copy address', () => {
|
||||
const result = UpdateCustomerSchema.safeParse({
|
||||
invoice_email_cc_addresses: ['not-an-email'],
|
||||
})
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('UpdateSupplierSchema', () => {
|
||||
|
||||
Reference in New Issue
Block a user