feat: make server own products
This commit is contained in:
@@ -63,16 +63,19 @@ acknowledge and ignore. Acknowledge it like any other event; it doesn't appear i
|
||||
The tablet sends `stock_set` when a product is created (unless untracked), when the default products are seeded, and
|
||||
when its stock or tracking is changed by hand.
|
||||
|
||||
### 3. Catalog (`products` in the request)
|
||||
### 3. Catalog: managed on the dashboard
|
||||
|
||||
- Keep upserting `name`, `category` and `priceInCents` per reported product.
|
||||
- **Ignore `stock`** in the report once the server owns the stock (keep accepting the field; older servers use it).
|
||||
- A product the server sees for the first time is created with `stock = null` (untracked). Its starting stock arrives
|
||||
as a `stock_set` event in the same request.
|
||||
- **Stop removing products that one tablet doesn't report**: with several tablets, tablet B not knowing a product of
|
||||
tablet A must not delete A's stock. Deleting or hiding products becomes a dashboard action (out of scope here).
|
||||
|
||||
Process `products` **before** the events of the same request, so a `stock_set` for a new product finds it.
|
||||
- The dashboard adds, changes and archives products (archived = deleted for the tablets, kept for tabs and history).
|
||||
A product added with a starting count is tracked from that moment.
|
||||
- The tablet's `products` report is only used on the first sync of the venue, to take over its catalog and stock once.
|
||||
After that it is ignored, also its `stock`.
|
||||
- The sync response sends `catalog`: every product of the venue,
|
||||
`[{ id, name, category, priceInCents, lowStockThreshold, archived }]`. The tablet adds and updates its products from
|
||||
it, and hides archived ones and ones the catalog doesn't list (such as the default products of a newly paired
|
||||
tablet). Leaving the key out means "the tablet manages its own catalog".
|
||||
- A paired tablet can't add, rename, reprice or delete products; it still counts stock (`stock_set`) and keeps its own
|
||||
product pictures until pictures are managed on the dashboard.
|
||||
- A `stock_set` for a product the venue doesn't have is acknowledged and ignored.
|
||||
|
||||
### 4. Dashboard stock adjustments
|
||||
|
||||
|
||||
Reference in New Issue
Block a user