From a5bbc24ecff7845a384a00cc3a234f2273459b8e Mon Sep 17 00:00:00 2001 From: aziz_28002 Date: Wed, 16 Sep 2026 20:41:45 +0400 Subject: [PATCH] fix: make order search case-insensitive instr() in SQLite compares bytes, so searching for a customer name in uppercase (e.g. "JOHN") silently missed lowercase-stored matches like "John". Lowercase both sides of the order number, name, and email comparisons so search matches regardless of the case staff paste in. Co-Authored-By: Claude Sonnet 5 --- apps/api/src/orders/order-repository.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/orders/order-repository.ts b/apps/api/src/orders/order-repository.ts index 5a904e1..20bc84c 100644 --- a/apps/api/src/orders/order-repository.ts +++ b/apps/api/src/orders/order-repository.ts @@ -39,9 +39,9 @@ export async function listOrderSummaries(context: DatabaseContext, query?: strin const filters = search ? or( - sql`instr(${orders.orderNumber}, ${search}) > 0`, - sql`instr(${users.name}, ${search}) > 0`, - sql`instr(${users.email}, ${search}) > 0` + sql`instr(lower(${orders.orderNumber}), lower(${search})) > 0`, + sql`instr(lower(${users.name}), lower(${search})) > 0`, + sql`instr(lower(${users.email}), lower(${search})) > 0` ) : undefined;