hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

[FEAT] List products #97

Closed EAZYLINK closed 2 weeks ago

EAZYLINK commented 1 month ago

Description

Develop an API endpoint to list products with pagination support. The endpoint should return basic information about each product, including the product name, price, and category.

Acceptance Criteria

  1. API Endpoint: Create an endpoint /api/products.
  2. Response Structure: The response should include:
  1. Response Pagination Info: Include pagination information in the response:

Purpose

To provide a means for clients to retrieve a paginated list of products with essential details, enhancing the user experience by allowing them to browse products efficiently.

Requirements

Request example

GET /api/products?page=1&limit=10

Expected Outcome

{
  "success": true,
  "message": "Product retrieved successfully",
  "products": [
    {
      "name": "Product 1",
      "price": 29.99,
      "category": "Electronics"
    },
    {
      "name": "Product 2",
      "price": 19.99,
      "category": "Books"
    },
    ...
  ],
  "pagination": {
    "totalItems": 100,
    "totalPages": 10,
    "currentPage": 1
  },
"status_code": 200
}
{
  "status": "error",
  "message": "Internal server error",
  "status_code": 500
}

Additional Notes:

nedssoft commented 1 month ago

@EAZYLINK update the Expected Outcome object to follow the accepted conventions

EAZYLINK commented 1 month ago

@nedssoft Updated

nedssoft commented 1 month ago

@EAZYLINK I didn't say you should remove the technical specs, take it back to what it was and read the slack message about conventions to understand what I meant

EAZYLINK commented 1 month ago

@nedssoft I have made the changes

buka4rill commented 1 month ago

Make this codeblock instead of code lines CleanShot 2024-07-17 at 18 10 14

buka4rill commented 1 month ago

You also need something like this CleanShot 2024-07-17 at 18 10 59

buka4rill commented 1 month ago

version your api also

nedssoft commented 1 month ago

@EAZYLINK prepend v1 to your API endpoint e.g v1/api/products

EAZYLINK commented 1 month ago

@markessien @nedssoft I have limited access to this ticket

nedssoft commented 1 month ago

What access do you want?

EAZYLINK commented 1 month ago

What access do you want?

assign