GET/api/ordering/dashboard

The 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.

1 parameter
datestringrequired
Montreal business day, `yyyy-mm-dd`. Required. Day-scoped endpoints filter on the **delivery** date (D-14).

4 status codes
200The day's tiles.
bakedRawobjectrequired
The delivery day's demand split by preparation. Identical to `GET /api/ordering/production/totals` for the same date — the same function produces both, so they cannot disagree.
packingobjectrequired
Packing progress for the delivery day, counted in ORDER LINES rather than orders — a half-packed order is half-done, not undone.
toShipintegerrequired
Orders packed or on their way out, for the delivery day. Excludes `shipped` and `closed` — they have already left, and a to-do tile that never falls as trucks depart is the opposite of useful.
ordersTodayintegerrequired
Orders CREATED on the date, all statuses. Drafts count: a draft the desk started is activity, and filtering to confirmed-or-later would make the number drop when someone confirms, which reads as work disappearing. It also keeps generated standing orders visible, since those are born `draft` (§6.2).
openDraftsintegerrequired
Orders still in `draft`, ACROSS ALL DAYS — work the desk has not finished. This is the one field `date` does not touch: a draft is unfinished desk work, and the draft worth surfacing is precisely the one nobody has looked at since the day it was started, so day-scoping it would hide exactly what it is for. The card that reads it links to the ALL-DATES order list, so the number a user clicks is the number they then count on screen.
400Invalid input — the `error` string says what was wrong.
errorstringrequired
401Not authenticated. Sign in first (see the Auth tag).
errorstringrequired
500Unexpected server error.
errorstringrequired

Error handling

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.