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

[FEAT]: Delete a Product By Id #344

Open
14 tasks
Kvngstar opened this issue Jul 27, 2024 · 0 comments
Open
14 tasks

[FEAT]: Delete a Product By Id #344

Kvngstar opened this issue Jul 27, 2024 · 0 comments
Labels

Comments

@Kvngstar
Copy link
Contributor

Kvngstar commented Jul 27, 2024

Description

Create an API endpoint to allow users to delete a product by its ID.

Acceptance Criteria

  • The endpoint should support deleting a product by its ID.
  • The endpoint requires user authentication.
  • Proper error handling should be implemented for invalid requests.
  • Implement rate limiting to restrict the number of requests a user can make to the endpoint.
  • The endpoint should return appropriate status codes for successful and unsuccessful requests.

Purpose

The purpose of this endpoint is to provide a way for users to delete products from our database by their ID.

Requirements

  • The endpoint should be a DELETE request to /api/v1/products/{product_id}.
  • The response should be in JSON format.
  • The endpoint requires user authentication.
  • Implement API rate limiting (e.g., 100 requests per 10 minutes per user).
  • Appropriate status codes should be returned for successful 200 OK and unsuccessful requests 404 Not Found, and 500 Internal Server Error.

Request Example

  • DELETE /api/v1/products/{product_id}

Successful Response

{
  "message": "Product deleted successfully",
  "status_code": 200
}

Unsuccessful Response

  • 404 Not Found
{
  "status": "Not Found",
  "message": "Product not found",
  "status_code": 404
}
  • 500 Internal Server Error
{
  "status": "An unexpected error occurred",
  "message": "Internal server error",
  "status_code": 500
}

Unit Tests

  • Test deleting a product by its ID.
  • Test the endpoint returns appropriate error messages for non-existent products.
  • Test rate limiting functionality.

Expected Outcome

  • The endpoint is able to delete a product by its ID.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants