fix case-insensitive order search #8

Open
karinah0333_16363 wants to merge 1 commits from kh-fix/case-insensitive-order-search into master
Collaborator

Summary

Order search was case-sensitive, so uppercase searches such as JOHN did not return orders for customers such as John Smith. This caused valid orders to be missing depending on how staff entered the search query.

Ticket / Assignment

What changed

  • Normalized the incoming order search query to lowercase after trimming whitespace.
  • Normalized order number, customer name, and customer email during database search comparisons.
  • Kept the change scoped to the existing order repository search logic.

How to test

List exact commands and manual checks.

bun run check
bun run test
bun run build:web

Manual checks:

  • Logged in as an employee and searched JOHN, john, and John. John Smith's orders appeared for all three searches.
  • Cleared the search query and verified that the full order list returned.

Screenshots or recordings

N/A — no UI change.

Risks / follow-ups

  • bun run check reports an existing TypeScript error in order-search-assignment-1.test.ts where string | undefined is assigned to employeeCookie. This PR does not modify that test file.
  • SQLite lower() is used for the searchable database fields, so this change is focused on the existing order search behavior without changing the frontend or API route structure.

PR checklist

  • change is scoped to one ticket or one small reviewable concern
  • acceptance criteria were checked
  • code follows CONTRIBUTING.md
  • no unrelated refactor is mixed in
  • debug code and temporary logs are removed
  • relevant automated checks were run locally
  • changed behavior was manually tested when needed
  • known risks or follow-ups are called out
## Summary Order search was case-sensitive, so uppercase searches such as `JOHN` did not return orders for customers such as John Smith. This caused valid orders to be missing depending on how staff entered the search query. ## Ticket / Assignment - Ticket: #1 - Assignment: Assignment 1 — case-insensitive order search ## What changed - Normalized the incoming order search query to lowercase after trimming whitespace. - Normalized order number, customer name, and customer email during database search comparisons. - Kept the change scoped to the existing order repository search logic. ## How to test List exact commands and manual checks. ```bash bun run check bun run test bun run build:web ``` Manual checks: - Logged in as an employee and searched JOHN, john, and John. John Smith's orders appeared for all three searches. - Cleared the search query and verified that the full order list returned. ## Screenshots or recordings N/A — no UI change. ## Risks / follow-ups - bun run check reports an existing TypeScript error in order-search-assignment-1.test.ts where string | undefined is assigned to employeeCookie. This PR does not modify that test file. - SQLite lower() is used for the searchable database fields, so this change is focused on the existing order search behavior without changing the frontend or API route structure. ## PR checklist - [x] change is scoped to one ticket or one small reviewable concern - [x] acceptance criteria were checked - [x] code follows `CONTRIBUTING.md` - [x] no unrelated refactor is mixed in - [x] debug code and temporary logs are removed - [x] relevant automated checks were run locally - [x] changed behavior was manually tested when needed - [x] known risks or follow-ups are called out
karinah0333_16363 added 1 commit 2026-09-18 00:49:14 +00:00
fix case-insensitive order search
Runner Test / test (push) Successful in 16s
Runner Test / test (pull_request) Successful in 15s
03663c4042
Owner

Code is good. Summary should be about the PR, not the ticket. Otherwise, good job on getting the assignment test to pass.

Code is good. Summary should be about the PR, not the ticket. Otherwise, good job on getting the assignment test to pass.
All checks were successful
Runner Test / test (push) Successful in 16s
Runner Test / test (pull_request) Successful in 15s
This pull request has changes conflicting with the target branch.
  • apps/api/src/orders/order-repository.ts
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin kh-fix/case-insensitive-order-search:kh-fix/case-insensitive-order-search
git checkout kh-fix/case-insensitive-order-search
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: derrick/ai-wave-02#8