hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
155 stars 136 forks source link

[FEAT] : Product Categories Listing API Endpoint #65

Open VictorIborTech opened 3 months ago

VictorIborTech commented 3 months ago

Description

Create an API endpoint to retrieve all product categories, providing essential information for product navigation and filtering.

Acceptance Criteria

Purpose

To provide clients with a comprehensive list of product categories, enabling effective navigation, filtering, and organization of products.

Requirements

Endpoint

Responses:

Success

{
  "status_code": 200,
  "categories": [
    {
      "id": 1,
      "name": "Electronics",
      "description": "Electronic devices and accessories",
      "slug": "electronics",
      "parent_id": null
    },
    {
      "id": 2,
      "name": "Clothing",
      "description": "Apparel and fashion items",
      "slug": "clothing",
      "parent_id": null
    }

  ]
}

Error

400 Bad Request: Invalid query parameters

{
  "status_code": 400,
  "error": {
    "code": "INVALID_QUERY_PARAMETER",
    "message": "The provided query parameter is invalid.",
    "details": {
      "invalid_parameter": "limit",
      "reason": "Must be a positive integer"
    }
  }
}

500 Internal Server Error: Server-side error

{
 "status_code": 500,
 "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "An unexpected error occurred while processing your request.",
    "details": {
      "support_email": "support@example.com"
    }
  }
}

Expected Outcome

Additional Information

Testing

VictorIborTech commented 3 months ago

Copied and Duplicated from #https://github.com/hngprojects/hng_boilerplate_nestjs/issues/257