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** * [ ] Create `/books/search` route * [ ] Parse `q` query param * [ ] Implement search logic: * [ ] Match against `name` * [ ] Match against `author` * [ ] Use partial matching (LIKE / ILIKE) * [ ] Handle empty query * [ ] Add Swagger documentation ### **Acceptance Criteria** * [ ] Returns matching books * [ ] Case-insensitive search * [ ] Partial matches work * [ ] Empty query returns `400` * [ ] Swagger UI supports testing ### **Testing Steps** * [ ] Add sample books * [ ] Test: ``` /books/search?q=harry ``` * [ ] Verify results include matching name/author * [ ] Test empty query → expect `400` ### **Definition of Done** * [ ] Search implemented * [ ] Edge cases handled * [ ] Swagger updated * [ ] 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