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

[finsihes 187354259] added endpoint to get all products #58

Merged
merged 1 commit into from
May 10, 2024

Conversation

Mag-codes
Copy link

Purpose

The purpose of this pull request is to add new endpoints and functionality to the application:

  • Added an endpoint to retrieve all products available in the database.
  • Added an endpoint to retrieve a specific product by its ID.
  • Added an endpoint for sellers to delete a product from their collection.

Changes Made

  • Added a new route and controller function for retrieving all products (getAllProduct).
  • Added a new route and controller function for retrieving a product by ID (getProductById).
  • Added a new route and controller function for sellers to delete a product (deleteProduct).
  • Implemented functionality to exclude expired products when retrieving all products.
  • Implemented error handling and response formatting for each endpoint.

Testing Instructions

To test the changes:

  1. Use an API testing tool like Postman or curl to send requests to the newly added endpoints.
  2. For the "Get All Products" endpoint:
    • Ensure that all products are retrieved successfully.
    • Verify that expired products are excluded from the results.
  3. For the "Get Product by ID" endpoint:
    • Send a request with a valid product ID and verify that the corresponding product is retrieved.
  4. For the "Delete Product" endpoint:
    • Send a DELETE request with a valid product ID and seller authentication.
    • Verify that the product is successfully deleted from the seller's collection.

Checklist

  • Code follows the project's coding standards
  • Changes are covered by tests
  • All tests pass

@Mag-codes Mag-codes added the WIP label May 8, 2024
@princenzmw princenzmw requested a review from hatfelicien May 8, 2024 19:21
@Mag-codes Mag-codes force-pushed the 187354259-ft-product-listing branch from 4f50cad to e98956b Compare May 8, 2024 22:26
Copy link
Contributor

@JeanIrad JeanIrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using the more compelling attributes name especially for size table, your code is really awesome sir!

@Mag-codes Mag-codes force-pushed the 187354259-ft-product-listing branch from e98956b to 97675c2 Compare May 10, 2024 14:46
added end point to get one product

added end point for a seller to delete a product from a his collection
@Mag-codes Mag-codes force-pushed the 187354259-ft-product-listing branch from 97675c2 to 1dc0f30 Compare May 10, 2024 14:55
@Mag-codes Mag-codes added ready and removed WIP labels May 10, 2024
Copy link
Collaborator

@amin-leon amin-leon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think once buyer clicks on any product, he can also get the seller info

src/controllers/productsController.ts Show resolved Hide resolved
@niyontwali niyontwali merged commit e345866 into develop May 10, 2024
7 checks passed
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 this pull request may close these issues.

7 participants