Open VictorIborTech opened 3 months ago
Create an API endpoint to retrieve all product categories, providing essential information for product navigation and filtering.
To provide clients with a comprehensive list of product categories, enabling effective navigation, filtering, and organization of products.
{ "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 } ] }
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" } } }
Copied and Duplicated from #https://github.com/hngprojects/hng_boilerplate_nestjs/issues/257
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
GET /api/v1/products/categories
Responses:
Success
Error
400 Bad Request: Invalid query parameters
500 Internal Server Error: Server-side error
Expected Outcome
Additional Information
Testing