feat(freight-api): add 9 commercial/finance reports

customer-status (company-profile roles, not Company — importer/
exporter/forwarder lives there), contract-lifecycle, customs-documents
(clearance milestones), invoicing-pipeline, first-last-mile-bookings
(one resolver, UNION ALL over first_mile/last_mile — verified the
raw-string .from() subquery against the live query builder, not just
hand-written SQL, after the join-alias bug earlier this branch),
invoices-by-status, payments-by-status, revenue-summary, cargo-summary.

payments carries no deleted_at column despite extending BaseEntity —
caught by column-checking against the live DB before shipping, dropped
the soft-delete filter for that one query.

Completes the ITLMS dashboard spec's 20-resolver dedup list (19 built,
freight-weight-variance dropped — no charged-vs-actual weight
distinction in the schema).
This commit is contained in:
Nathnael
2026-08-13 08:23:19 +00:00
parent a53a9c7152
commit 29913259f6
11 changed files with 656 additions and 0 deletions

View File

@@ -69,6 +69,15 @@ export const REPORT_KEYS = [
"wagon-teu-utilization",
"loaded-capacity",
"global-logistics-wagons",
"customer-status",
"contract-lifecycle",
"customs-documents",
"invoicing-pipeline",
"first-last-mile-bookings",
"invoices-by-status",
"payments-by-status",
"revenue-summary",
"cargo-summary",
] as const;
export type ReportKey = (typeof REPORT_KEYS)[number];