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; diff --git a/apps/api/src/orders/order-search-assignment-1.test.ts b/apps/api/src/orders/order-search-assignment-1.test.ts index b3724f5..49cad2f 100644 --- a/apps/api/src/orders/order-search-assignment-1.test.ts +++ b/apps/api/src/orders/order-search-assignment-1.test.ts @@ -7,7 +7,7 @@ let app: AppWithContext; let employeeCookie = ""; function firstHeader(value: string | string[] | undefined) { - return Array.isArray(value) ? value[0] : value ?? ""; + return Array.isArray(value) ? (value[0] ?? "") : value ?? ""; } async function login(username: string) {