Add search capability to find books by name or author. ### **User Story** **Given** books exist **When** I search by keyword **Then** I should get matching books ### **Endpoint** ``` GET /books/search?q=<keyword> ``` ### **Tasks** * [x] Create `/books/search` route * [x] Parse `q` query param * [x] Implement search logic: * [x] Match against `name` * [x] Match against `author` * [x] Use partial matching (LIKE / ILIKE) * [x] Handle empty query * [x] Add Swagger documentation ### **Acceptance Criteria** * [x] Returns matching books * [x] Case-insensitive search * [x] Partial matches work * [x] Empty query returns `400` * [x] Swagger UI supports testing ### **Testing Steps** * [x] Add sample books * [x] Test: ``` /books/search?q=harry ``` * [x] Verify results include matching name/author * [x] Test empty query → expect `400` ### **Definition of Done** * [x] Search implemented * [x] Edge cases handled * [x] Swagger updated * [x] Code linted and formatted
Add search capability to find books by name or author.
User Story
Given books exist
When I search by keyword
Then I should get matching books
Endpoint
Tasks
/books/searchrouteqquery paramnameauthorAcceptance Criteria
400Testing Steps
Add sample books
Test:
Verify results include matching name/author
Test empty query → expect
400Definition of Done