Add customer names on the ledger, staff session login, and exclusive jobs.events.
Some checks are pending
offline / test (push) Waiting to run

Account-balance stores display names and looks up by name. Edge writes
names on customer create/edit; staff UIs join from edge when needed.
New verae-staff-session issues a host cookie; department HTML redirects
when STAFF_AUTH=1. JOBS_EVENTS_EXCLUSIVE lets jobs-events own the durable
consumer. Catalog index is cards; disabled fleet machines are grey.
This commit is contained in:
George Lambert 2026-09-11 18:11:21 -04:00
parent cb07f5b321
commit 9cc0018708
38 changed files with 533 additions and 68 deletions

View file

@ -0,0 +1,25 @@
/** Join ledger ids to zappier-edge customer display names. */
export async function withCustomerName(st, idOrName, edge, key) {
const out = { ...(st || {}) };
if (out.name && out.customerId) return out;
try {
const r = await fetch(`${edge.replace(/\/$/, '')}/admin/api/customers`, {
headers: { 'x-admin-key': key },
});
const { customers } = await r.json();
const want = String(idOrName || out.customerId || '').toLowerCase();
const c = (customers || []).find(
(x) =>
x.id === idOrName ||
x.id === out.customerId ||
String(x.name || '').toLowerCase() === want,
);
if (c) {
out.name = c.name;
out.customerId = c.id;
}
} catch {
/* edge optional */
}
return out;
}