35 lines
1.2 KiB
Markdown
35 lines
1.2 KiB
Markdown
# Order Items Naming Standard (PocketBase)
|
|
|
|
## Goal
|
|
Use one consistent, driver-oriented naming convention in `order_items` with `drv_*` prefixes.
|
|
|
|
## Recommended Canonical Fields
|
|
- `item_status` (global item lifecycle)
|
|
- `drv_status` (driver/collection lifecycle)
|
|
- `drv_id` (relation to driver/user table)
|
|
- `drv_assigned_at`
|
|
- `drv_collected_at`
|
|
- `drv_problem_flag`
|
|
- `drv_problem_type`
|
|
- `drv_problem_notes`
|
|
|
|
## Transition Mapping
|
|
During migration, support these aliases in API:
|
|
- `driver_status` -> `drv_status`
|
|
- `driver` -> `drv_id`
|
|
- `problem_flag` -> `drv_problem_flag`
|
|
- `problem_type` -> `drv_problem_type`
|
|
- `problem_notes` -> `drv_problem_notes`
|
|
|
|
## Safe Migration Plan
|
|
1. Add new `drv_*` fields (keep old fields temporarily).
|
|
2. Backfill new fields from existing values.
|
|
3. Update UI and automation writes to new fields only.
|
|
4. Keep read-compat for old fields for 1-2 release cycles.
|
|
5. Remove deprecated fields once no writers remain.
|
|
|
|
## Minimal State Model
|
|
- `item_status`: `pending`, `processing`, `po_generated`, `ready_delivery`, `delivered`, `cancelled`
|
|
- `drv_status`: `unassigned`, `assigned`, `en_route`, `collected`, `failed`
|
|
|
|
Keep item lifecycle and driver lifecycle separate to avoid status collisions.
|