The application lacked a robust search functionality to allow users to search for books.
Related Issue: Closes #41
Changes
Search Functionality
Files Modified: ArchiveController.java
Added logic in the getSearchResult() method to handle search queries and pagination.
Added logic to trim and validate search queries.
Encoded the search query and made a request to the Google Books API.
Processed the API response to extract book details and manage pagination.
Handled errors by setting appropriate messages in the model.
Book Data Transfer Object
Files Created: BookDTO.java
Added fields for book details like title, ID, average rating, and thumbnail.
Created getter and setter methods for these fields to encapsulate the book data.
Thymeleaf Template Updates
Files Modified: searchresult.html, bookcard.html, homepage.html
Updated the template to display search results and messages.
Implemented pagination controls and logic to handle multiple pages of results.
Added a message display for empty or invalid search queries.
Commented out the book card display on the homepage
JavaScript Enhancements
Files Modified: search.js
Enhanced the script to manage search queries and pagination links.
Added validation to alert users when they enter an empty search query.
Style Modification
Files Modified: card.css, style.css
Modified attributes for better UI.
Added CSS attributes for the pagination in the style.css.
Issue
The application lacked a robust search functionality to allow users to search for books.
Related Issue: Closes #41
Changes
Search Functionality
Files Modified:
ArchiveController.java
Added logic in thegetSearchResult()
method to handle search queries and pagination. Added logic to trim and validate search queries. Encoded the search query and made a request to the Google Books API. Processed the API response to extract book details and manage pagination. Handled errors by setting appropriate messages in the model.Book Data Transfer Object
Files Created:
BookDTO.java
Added fields for book details like title, ID, average rating, and thumbnail. Created getter and setter methods for these fields to encapsulate the book data.Thymeleaf Template Updates
Files Modified:
searchresult.html
,bookcard.html
,homepage.html
Updated the template to display search results and messages. Implemented pagination controls and logic to handle multiple pages of results. Added a message display for empty or invalid search queries. Commented out the book card display on the homepageJavaScript Enhancements
Files Modified:
search.js
Enhanced the script to manage search queries and pagination links. Added validation to alert users when they enter an empty search query.Style Modification
Files Modified:
card.css
,style.css
Modified attributes for better UI. Added CSS attributes for the pagination in thestyle.css
.