Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Filter products by category in Get all Product endpoint #412

Open
Odili1 opened this issue Feb 27, 2025 · 0 comments · May be fixed by #437
Open

[Fix] Filter products by category in Get all Product endpoint #412

Odili1 opened this issue Feb 27, 2025 · 0 comments · May be fixed by #437
Assignees
Labels

Comments

@Odili1
Copy link

Odili1 commented Feb 27, 2025

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
@Odili1 Odili1 changed the title [Feat] Implement endpoint to get products by category [Feat] Filter products by category Feb 27, 2025
@Odili1 Odili1 changed the title [Feat] Filter products by category [Fix] Filter products by category Feb 27, 2025
@Odili1 Odili1 changed the title [Fix] Filter products by category [Fix] Filter products by category in Get all Product endpoint Feb 27, 2025
@Aniyikaye-Alabi Aniyikaye-Alabi self-assigned this Feb 28, 2025
@Odili1 Odili1 linked a pull request Mar 1, 2025 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants