feat: paginate customer orders and polish the dashboard hero

Add paged orders API and infinite scroll, short order numbers, and align the guest invite card with the logged-in hero shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-17 13:11:42 +03:30
co-authored by Cursor
parent f550172567
commit afb068c643
89 changed files with 4518 additions and 1325 deletions
@@ -0,0 +1,14 @@
-- App (B2B) orders were stored as RETAIL because createOrder defaulted
-- channel to RETAIL and the apps never sent one. Legacy's mobile setOrder
-- wrote to the wholesale `orders` table.
--
-- Flip mis-filed rows: any RETAIL order whose customer is NOT a تک
-- (CustomerKind.RETAIL) belongs on the omde list. Genuine retail-list
-- orders for CustomerKind.RETAIL stay RETAIL.
UPDATE "Order" AS o
SET channel = 'WHOLESALE'
FROM "Customer" AS c
WHERE o."customerId" = c.id
AND o.channel = 'RETAIL'
AND c.kind <> 'RETAIL';
@@ -0,0 +1,31 @@
-- Short global customer-facing order numbers (SMS / app), replacing
-- ORD-{timestamp}-{random}. Pure digits, starting at 100.
-- Existing ORD-* / MOCK-ORD-* rows stay as-is; the sequence only advances
-- past any already-numeric orderNumber so new allocations never collide.
DROP SEQUENCE IF EXISTS order_number_seq;
CREATE SEQUENCE order_number_seq
AS BIGINT
INCREMENT BY 1
MINVALUE 1
START WITH 100
NO CYCLE;
DO $$
DECLARE
max_numeric bigint;
BEGIN
SELECT MAX("orderNumber"::bigint)
INTO max_numeric
FROM "Order"
WHERE "orderNumber" ~ '^[0-9]+$';
IF max_numeric IS NULL THEN
-- next nextval() returns 100
PERFORM setval('order_number_seq', 100, false);
ELSE
-- next nextval() returns max_numeric + 1
PERFORM setval('order_number_seq', max_numeric, true);
END IF;
END $$;