[JITERA] Implement Book Controller with CRUD Operations
requested to merge feat/book-controller-implementation-1751535920 into feat/search-module-1748920047
Created by: chi-jitera
Overview
This pull request implements the book controller for managing book-related operations in the application. It includes the creation, retrieval, updating, deletion, and searching of books.
Changes
-
createBook:
- Added a method to create a new book. It uses the
bookService.createBookmethod and returns a 201 status with the created book data or a 400 status with an error message if the creation fails.
- Added a method to create a new book. It uses the
-
getAllBooks:
- Implemented a method to retrieve all books. It calls
bookService.getAllBooksand returns the list of books in JSON format.
- Implemented a method to retrieve all books. It calls
-
getBookById:
- Added a method to retrieve a specific book by its ID. It uses
bookService.getBookByIdand returns a 404 status with an error message if the book is not found.
- Added a method to retrieve a specific book by its ID. It uses
-
updateBook:
- Implemented a method to update an existing book by its ID. It calls
bookService.updateBookand returns the updated book data or a 400 status with an error message if the update fails.
- Implemented a method to update an existing book by its ID. It calls
-
deleteBook:
- Added a method to delete a book by its ID. It uses
bookService.deleteBookand returns a success message or a 404 status with an error message if the book is not found.
- Added a method to delete a book by its ID. It uses
-
searchBooks:
- Implemented a method to search for books based on query parameters. It calls
bookService.searchBooksand returns the search results or a 400 status with an error message if the search fails.
- Implemented a method to search for books based on query parameters. It calls
This implementation provides a complete set of CRUD operations for managing books in the application.