-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
Description
Make a change to the get all products endpoint. The endpoint should also be able to search for products by categories. The endpoint will optionally accept a category as a query param, validate if it is a valid product category and gets the list of product under that category. The client will receive a 200 upon a successful fetch and a 404 if no products under the category is found. In addition, tests should be included to improve quality, maintainability and to ensure the endpoint work as expected.
Acceptance Criteria
- Accepts and validate category as query param if added
- Return appropriate response and status code
Requirements
- Method: GET
- URL: /api/v1/organisations/{orgId:guid}/products?category={string}
- Headers: application/json
Response:
Successful Response
{
"message": "string",
"success": true,
"status_code": int,
"data": []
}
Error Response
{
"message": "string",
"success": false,
"status_code": int
}
Response Codes:
- 200 Created: When products are found.
- 404 Not Found: If no product exist.
- 500 Internal Server Error: For unexpected errors.
Unit Tests
- If the category query param is provided, ensure it is a valid category
- To ensure that the appropriate response format and status code is returned