Skip to content

[JITERA] Add PATCH /books/:id route for partial updates

chi le requested to merge feat/add-patch-route-for-books-1755179059 into main

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

  1. 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
  2. Utilization of Existing Logic:

    • The new PATCH route delegates to the existing updateBook method in bookController.js, which already supports partial updates. This means that the same business logic is used, ensuring consistency and reducing code duplication.

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.

Merge request reports