SanzaGemini / Stores-Inventory

0 stars 0 forks source link

Implement GET Method for Retrieving All Products from Inventory #11

Open SanzaGemini opened 1 week ago

SanzaGemini commented 1 week ago

Description:

Create an endpoint that allows users to retrieve a list of all products available in the inventory database. This feature should return the product details in a structured format.

Acceptance Criteria:

  1. Endpoint Creation:

    • A GET endpoint /api/products is created.
  2. Response Format:

    • The response should return a JSON array containing the details of all products, including:
      • id (Long)
      • name (String)
      • description (String)
      • price (Decimal)
      • quantity (Integer)
  3. Database Interaction:

    • Fetch all products from the inventory database.
    • Use JPA/Hibernate for database interactions.
  4. Response:

    • On success, return HTTP status 200 (OK) with the list of products.
    • If no products are found, return an empty array.
  5. Error Handling:

    • Handle database errors and return appropriate responses (e.g., 500 Internal Server Error).

Tasks: