fixed issue with searcing #5

Open
notsicilian wants to merge 3 commits from fs-fix-search-order into master
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 8f619214f0 - Show all commits
+3 -3
View File
@@ -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`,
Review

Instead of using lower() on search here, apply it above so that we don't cast it 3x here.

Instead of using `lower()` on `search` here, apply it above so that we don't cast it 3x here.
Review

Clear, Sir I will

Clear, Sir I will
sql`instr(lower(${users.name}), lower(${search})) > 0`,
sql`instr(lower(${users.email}), lower(${search})) > 0`
)
: undefined;
@@ -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 ?? "";
Review

Assignment test should not be modified.

Assignment test should not be modified.
Review

Clear

Clear
}
async function login(username: string) {