feat(auth): migrate contacts + billing to TenantId (PMS-139 sweep batch 5) #164
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-139-sweep-contacts-billing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Batch 5 of the PMS-139 typed-tenant sweep: migrate
contactsandbilling, the two remaining leaf consumers, from bareUuidtenant ids to theTenantIdnewtype. This leaves only the hub modules (audit,notifications,tickets) for the final batch.How
user.tenant()(TenantScoped, now imported in eachroutes.rs); every public service method takestenant_id: TenantId. Transparent newtype -> SQL binds and%tenant_idtracing unchanged.audit_writecalls (9 contacts, 11 billing) unwrap withtenant_id.get()transitionally until the audit hub is swept last. ThePaymentResponseDTO field is populated fromtenant_id.get()(the response model carries a plainUuid).CompanyRow,ContactRow,SiteRow,PaymentRow,InvoiceRow) keep theirUuidfields - DB decodes, not the handler boundary.from_trusted+ SAFETY note: the out-of-scope portal invoice feed (verified contact-JWT tenant, like batch 4's KB feed), the demoseeder (trusted system actor seeding a claimed tenant id), and the billing recurring-invoice cross-tenant sweep (tenant ids read off thetenantstable).tests/recurring_invoicing.rswraps its literal tenant ids withfrom_trusted;tests/billing.rsandtests/contacts.rsdrive the HTTP layer and needed no change.Verification
cargo check --all-targets,cargo clippy --all-targets: clean.cargo test --test contacts(7),--test billing(3),--test recurring_invoicing(5): pass.cargo test --doc:compile_failnewtype guard holds (2 pass / 3 ignored).Progress: 13 of ~17 modules migrated. The final batch sweeps
audit/notifications/tickets(theaudit_write/notifications::dispatch/TicketServicehubs); flipping those removes every transitionaltenant_id.get()from batches 1-5.🤖 Generated with Claude Code