Skip to content

[JITERA] Add Author Routes for CRUD Operations

Klebson Leite requested to merge feat/add-author-routes-1749129919 into main

Overview

This pull request introduces new routes for managing authors in the application. The routes allow for the creation, retrieval, updating, and deletion of author records, enhancing the functionality of the author management system.

Changes

  1. Added Author Routes:

    • Implemented routes for creating, reading, updating, and deleting authors.
    • The routes are defined in src/routes/authorRoutes.js.
  2. GET /authors:

    • Fetches a list of all authors from the database.
    • Returns a JSON response with author details.
  3. GET /authors/:id:

    • Fetches a single author by ID.
    • Returns a JSON response with the author's details or a 404 error if not found.
  4. POST /authors:

    • Allows the creation of a new author.
    • Expects author details in the request body and returns the created author object.
  5. PUT /authors/:id:

    • Updates an existing author's details.
    • Expects updated author details in the request body and returns the updated author object.
  6. DELETE /authors/:id:

    • Deletes an author by ID.
    • Returns a success message upon successful deletion or a 404 error if the author is not found.

Testing

  • All new routes have been tested using Postman to ensure they function as expected.
  • Unit tests have been added to verify the behavior of each route.

This implementation will provide a solid foundation for managing authors within the application.

Merge request reports