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

@@ -8,6 +8,7 @@ function shape(row) {
entityId: row.entityId,
contactType: row.contactType,
contact: row.contact,
sort: row.sort,
};
}
@@ -50,12 +51,21 @@ export default function update(pool) {
throw new Error('Contact required');
}
let sort = current.sort;
if (Object.prototype.hasOwnProperty.call(patch, 'sort')) {
if (!Number.isFinite(patch.sort)) {
throw new Error('Invalid sort');
}
sort = patch.sort;
}
const result = await pool
.request()
.input('id', id)
.input('entityId', entityId)
.input('contactType', contactType)
.input('contact', contact)
.input('sort', sort)
.query(UPDATE);
const row = result.recordset[0];