POST /api/operator/orders/{id}/redesign-preview (sent, approved,
rejected), redesign_previews table, previews on every board order, and
assign_late leaves out the time a preview waited for the customer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
726 B
SQL
16 lines
726 B
SQL
-- Round 5, D2 (order from 2026-11-16): a redesign's preview, sent to the
|
|
-- customer, waiting for approval or rejection. One preview is open at a time.
|
|
CREATE TABLE IF NOT EXISTS dtf_local.redesign_previews (
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
order_id uuid NOT NULL REFERENCES dtf_local.orders(id) ON DELETE CASCADE,
|
|
number int NOT NULL,
|
|
sent_at timestamptz NOT NULL DEFAULT now(),
|
|
sent_by text NOT NULL,
|
|
decided_at timestamptz,
|
|
result text CHECK (result IN ('approved','rejected')),
|
|
reason text NOT NULL DEFAULT '',
|
|
decided_by text,
|
|
UNIQUE (order_id, number)
|
|
);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS redesign_previews_open ON dtf_local.redesign_previews(order_id) WHERE decided_at IS NULL;
|