[JITERA] Add PATCH /books/:id route for partial updates
Created by: chi-jitera
Overview
This pull request introduces a new PATCH route for updating book records partially. The new route allows clients to send only the fields they wish to update, aligning with RESTful practices.
Changes
-
Added PATCH Route:
- In
routes/bookRoutes.js, a new route has been added to handle PATCH requests for updating books.
router.patch('/books/:id', bookController.updateBook); // Added PATCH handler - In
-
Utilization of Existing Logic:
- The new PATCH route delegates to the existing
updateBookmethod inbookController.js, which already supports partial updates. This means that the same business logic is used, ensuring consistency and reducing code duplication.
- The new PATCH route delegates to the existing
This implementation allows for efficient and flexible updates to book records, enhancing the API's usability without requiring additional changes to the controller or service layers.