Data model
PostgreSQL, one schema: integrations. The model is defined in C# (src/Integrations.Domain), mapped in
src/Integrations.Infrastructure/Persistence/Configurations, and changed only through EF Core migrations.
entities, tax_documents, tax_code_mappings, parties, certificate_requests and reconciliation_issues also
carry created_by and modified_by: the caller (token client id, bus:<publisher> or system:<job>) stamped as the
row is saved.
The diagram shows the key columns only. The .NET reference documents every property of the domain classes.
Tables
| Table | Holds | Key constraints |
|---|---|---|
entities | Legal entities, AvaTax company, currency, GL accounts (jsonb), one features_* column per flag | PK id |
tax_documents | AR/AP invoices and credits, status, totals, raw AvaTax response | Unique (entity, source system, source document, direction, kind); unique provider_document_code; index (status, next_attempt_at) for the recalculation job |
tax_document_lines | Lines: category, work type, tax code, amounts | Unique (document, line number) |
tax_line_jurisdictions | Tax per line per jurisdiction (state/county/city/special/country) | Index (country, region, level, code) for jurisdiction reports |
tax_code_mappings | Category + work type/sub-type/trade → tax code, effective dates | Index (category, work type, active) |
exchange_rates | Daily rates as published, never updated | Unique (source, currency, pivot, date) |
rate_locks | First lock per pair per day | Unique (from, to, rate date, source) |
parties | Customers and vendors, sync status | Unique (entity, type, code) |
certificate_requests | Certificate invites and resale requests | Index (entity, kind, status), PO number |
certificate_expiry_notices | Expiry notices already sent | Unique (entity, certificate, expiry date) |
provider_call_audit | One row per external call: latency, outcome, request hash, caller, entity | Index (occurred_at), (entity, subject) |
admin_audit | Append-only: commits, voids, credits, entity and mapping changes, resolved issues, cancelled requests; who and when | Index (occurred_at), (entity, subject) |
reconciliation_issues | Differences found by reconciliation | Index (entity, date), resolved |
inbox_state, outbox_message, outbox_state | MassTransit transactional outbox/inbox | Managed by MassTransit |
Money and precision
Amounts are numeric(19,6) (the default for every decimal, set once in ConfigureConventions) and rates are numeric(28,12) (set on each rate column). Rounding to currency
minor units happens only in API responses and events.