/api/ordering/dashboardThe ordering dashboard's stat tiles
The A1 landing page in one round trip: what the day owes the floor, how far packing has got, how much is waiting to go out, and how many orders were taken.
This endpoint computes almost nothing. bakedRaw is the production worksheet's hero total, the packing fraction is the packing day board's, and toShip slices the same day's orders that board already groups. Each is a call into the module that owns it. A dashboard that recomputed them would be a second opinion about the day, and that failure is silent — the tiles saying 400 while the worksheet says 380, with nothing erroring. This codebase has been bitten by exactly that twice, which is why packing.inventory.js exists.
One date, THREE axes, on purpose. bakedRaw / packing / toShip are keyed on the delivery date (D-14). ordersToday is keyed on the order date, because it counts order-taking activity — counting it on the delivery axis would duplicate toShip's denominator and make the label a lie. openDrafts (added 2026-08-21) ignores date entirely: a draft is unfinished desk work, and the one worth surfacing is the one nobody has looked at since it was started, so day-scoping it would hide exactly what it is for. Its card links to the ALL-DATES order list for the same reason.
Five DB-side aggregates issued in parallel; none loads a row into memory, so a growing order book does not turn the landing page into a full-day scan.
A 400 is returned: Invalid input — the error string says what was wrong. A 401 is returned: Not authenticated. Sign in first (see the Auth tag). A 500 is returned: Unexpected server error.