updates on the bookings page and updated ai and more thngs

This commit is contained in:
2026-09-11 11:20:38 +05:30
parent 1caa7b71a9
commit 49ee0c5076
40 changed files with 5796 additions and 359 deletions

View File

@@ -4,11 +4,19 @@ import { parseDoormileTimestamp } from '@/lib/doormileTimestamp';
/**
* Reading bookings for the assistant.
*
* `GET /admin/bookings` has no date, status or tenant filter and caps `pagesize`
* at 1000 server-side, so every question is answered by draining pages and
* filtering here. A single `getBookings(1, 1000)` silently under-reports the
* moment an account passes 1000 lifetime bookings, which is why nothing in the
* assistant calls it.
* `GET /admin/bookings` caps `pagesize` at 100 server-side — NOT 1000, which is
* what this comment claimed for a long time and what `express-console-api.md`
* documented. A page is 100 rows, so MAX_PAGES x BULK_PAGESIZE is not the
* reachable total: 12 pages is 1200 rows, not 12,000.
*
* It IS tenant-scoped, and it does accept `?status=` — but as an exact,
* case-sensitive, single-value match against the stored capitalised enum
* (`Pending_Pickup`). The status GROUPS this console renders as tabs each cover
* several values in lowercase, so the server filter cannot express a tab and
* the grouping still happens here. There is no date filter.
*
* The list is ordered `bookingid DESC`, so page 1 is the newest page and a
* drain that stops early keeps the most recent bookings rather than the oldest.
*
* Every scan returns `{ rows, truncated, scanned, pagesFetched, total }` rather
* than a bare array, and **`truncated` is not optional to handle**. A count