Add ledger, address/contact sort, and tighter schema-graph layout.

Replace manifestarticle.transactedamount with an append-only ledger, add sort on entity address/contact, and allow same-rank FKs with crossing-aware exits in the graph.
This commit is contained in:
seb
2026-08-06 07:39:48 +02:00
parent 3b77a1c946
commit ae549fd022
17 changed files with 2019 additions and 1656 deletions

View File

@@ -22,7 +22,6 @@ export function shapeLine(row) {
sku: row.sku ?? null,
amount: row.amount,
net: row.net,
transactedAmount: row.transactedAmount,
rebate: row.rebate,
tax: row.tax,
comment: row.comment ?? null,
@@ -80,10 +79,6 @@ export function normalizeLines(lines) {
const rebate =
entry?.rebate === undefined || entry?.rebate === null ? 0 : entry.rebate;
const tax = entry?.tax;
const transactedAmount =
entry?.transactedAmount === undefined || entry?.transactedAmount === null
? amount
: entry.transactedAmount;
const comment =
entry?.comment === undefined || entry?.comment === null
? null
@@ -93,12 +88,11 @@ export function normalizeLines(lines) {
!Number.isFinite(amount) ||
!Number.isFinite(net) ||
!Number.isFinite(rebate) ||
!Number.isFinite(tax) ||
!Number.isFinite(transactedAmount)
!Number.isFinite(tax)
) {
throw new Error('Invalid lines');
}
return { sku, amount, net, rebate, tax, transactedAmount, comment };
return { sku, amount, net, rebate, tax, comment };
});
}

View File

@@ -57,7 +57,6 @@ export async function insertLines(
.input('articleId', articleId)
.input('amount', line.amount)
.input('net', line.net)
.input('transactedAmount', line.transactedAmount)
.input('comment', line.comment)
.input('rebate', line.rebate)
.input('taxId', taxId)