feat: progressive price bands per product (front 8.2)
A price may carry up to five bands, "from N m, R$ Y": the order's total billed metres of that product chooses one price for its whole quantity, the manual-file extra still on top. Bands start and become history with their price row. The Site charges the same band for the cart, shows "Faltam X m para R$ Y o metro" and lists the bands under the price table; the Kanban's Site tab edits them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -617,3 +617,8 @@ CREATE TABLE IF NOT EXISTS dtf_local.product_prices (
|
||||
created_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS product_prices_current ON dtf_local.product_prices(product, starts_at DESC);
|
||||
|
||||
-- Front 8.2: a price may also have bands by the order's total metres of that
|
||||
-- product: base price, then "from 5 m R$ Y", "from 20 m R$ Z" (jsonb list of
|
||||
-- {"from_metres": "5", "unit_cents": 1990}, strictly increasing, at most 5).
|
||||
ALTER TABLE dtf_local.product_prices ADD COLUMN IF NOT EXISTS bands jsonb NOT NULL DEFAULT '[]';
|
||||
|
||||
Reference in New Issue
Block a user