fixed issue with searcing #5
3 Participants
Notifications
Due Date
No due date set.
Blocks
#1 Assignment 1
derrick/ai-wave-02
Reference: derrick/ai-wave-02#5
Reference in New Issue
Block a user
Summary
Order search on the orders list was case-sensitive: searching
JOHNreturned no results for customers named "John". Employees couldn't find orders by customer name, email, or order number unless they typed the exact stored case in the search box.Ticket / Assignment
order-search-assignment-1.test.ts)What changed
apps/api/src/orders/order-repository.ts: appliedlower()toorderNumber, customername, customeremail, and the query value in theinstrfilter so matching is case-insensitive.apps/api/src/orders/order-search-assignment-1.test.ts: null-safeset-cookieheader extraction in the test login helper.How to test
Manual checks:
Screenshots or recordings
N/A. API/behavioral change only.
Risks / follow-ups
PR checklist
CONTRIBUTING.md@@ -42,3 +42,1 @@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`,Instead of using
lower()onsearchhere, apply it above so that we don't cast it 3x here.Clear, Sir I will
@@ -8,3 +8,3 @@function firstHeader(value: string | string[] | undefined) {return Array.isArray(value) ? value[0] : value ?? "";return Array.isArray(value) ? (value[0] ?? "") : value ?? "";Assignment test should not be modified.
Clear
Summary needs to be the summary of the PR, not the ticket. Can just link the ticket in ticket/assignment next time. The update to the code should pass the test, just that a slight change would be better. Otherwise, good job on the PR.
Clear, Sir I will consider these points next PR
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.