Add PocketBase collections, APIs & migration docs
Introduce PocketBase workflow support, migration tooling, server APIs and documentation. Adds a set of PocketBase collection JSONs (order_items, order_items_v2, collection_pool, delivery_notes, delivery_note_items, repairs) and a large import manifest for workflow collections; includes docs describing MCP/API layer, migration audit, order-item schema and rollout plans. Adds server-side agent/MCP endpoints and services (api/mcp, api/v1/orders, collection-pool, order-items status, health) plus helper modules (pocketbase-admin, orders-service, order-item-status, agent-auth) and a migration script to create order_items_v2/collection_pool. UI: new pages for collection-pool, delivery-notes, repairs and several updates to orders/quotes pages, sidebar, tooltip and pb helpers/types. Also updates package.json (migration script and related changes) and global styles. Required env vars and suggested migration command are documented (e.g. NEXT_PUBLIC_POCKETBASE_URL, PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD, ORDER_ITEMS_COLLECTION; run npm run pb:migrate:orders-v2).
2026-05-25 16:39:33 +00:00
|
|
|
# Core Recheck Matrix (Quotes, Orders, Company, Customer)
|
|
|
|
|
|
|
|
|
|
## Ground Rules
|
|
|
|
|
- Quotes workflow is separate from driver/pool workflows.
|
|
|
|
|
- Driver and collection states apply only after quote-to-order conversion on `order_items`.
|
|
|
|
|
- Order creation from quote must not mutate quote status.
|
|
|
|
|
|
|
|
|
|
## 1) Quotes Recheck
|
|
|
|
|
- Collections:
|
|
|
|
|
- `quotes`
|
|
|
|
|
- `quote_items`
|
|
|
|
|
- Must verify:
|
|
|
|
|
- create quote
|
|
|
|
|
- add/edit/remove quote items
|
|
|
|
|
- claim/unclaim
|
|
|
|
|
- process status transitions (`new -> claimed -> processed -> emailed/approval_pending -> approved/rejected/complete`)
|
|
|
|
|
- email metadata fields persist
|
|
|
|
|
- API/logic check:
|
|
|
|
|
- quote actions never touch `drv_status`, `collection_pool`, or driver assignment fields.
|
|
|
|
|
|
|
|
|
|
## 2) Orders Recheck
|
|
|
|
|
- Collections:
|
|
|
|
|
- `orders`
|
|
|
|
|
- `order_items` (new schema replacement)
|
|
|
|
|
- `purchase_orders`
|
|
|
|
|
- `collection_pool`
|
|
|
|
|
- Must verify:
|
|
|
|
|
- create order from quote via API
|
|
|
|
|
- copied order item values (description/qty/supplier/pricing)
|
|
|
|
|
- order item status updates (`item_status` + `drv_status`)
|
|
|
|
|
- PO generation per supplier
|
|
|
|
|
- no quote status mutation on order creation
|
|
|
|
|
|
|
|
|
|
## 3) Company Recheck
|
|
|
|
|
- Collections:
|
|
|
|
|
- `companies`
|
|
|
|
|
- `company_details`
|
|
|
|
|
- Must verify:
|
|
|
|
|
- list/search/pagination
|
|
|
|
|
- create/edit/delete
|
|
|
|
|
- relation usage in quotes/orders
|
|
|
|
|
- address/vendor consistency with old Django usage
|
|
|
|
|
|
|
|
|
|
## 4) Customer Recheck
|
|
|
|
|
- Collections:
|
|
|
|
|
- `customers`
|
|
|
|
|
- Must verify:
|
|
|
|
|
- list/search/pagination
|
|
|
|
|
- create/edit/delete
|
|
|
|
|
- email fields (`email`, `alternative_email`, `buyer_email`)
|
|
|
|
|
- relation/linking in quotes/orders
|
|
|
|
|
- duplicate handling strategy (from old merge commands)
|
|
|
|
|
|
|
|
|
|
## Current Alignment Status
|
|
|
|
|
- Quotes/order separation fixed in service layer.
|
|
|
|
|
- Orders-first API and MCP layer in place.
|
|
|
|
|
- New `order_items` replacement schema prepared for import.
|
|
|
|
|
- `collection_pool` schema prepared.
|
|
|
|
|
|
|
|
|
|
## Next implementation focus
|
|
|
|
|
1. Wire UI screens for `order_items` new fields while keeping same look/behavior.
|
|
|
|
|
2. Add explicit quote-to-order action in quote detail/process pages.
|
2026-06-11 18:30:02 +00:00
|
|
|
3. Add a lightweight validation script for collection field drift vs expected schema.
|