Spaces:
Running
Running
sdacelo commited on
Commit ·
2c00ac0
1
Parent(s): d9bf42a
comment out delete
Browse files
app.py
CHANGED
|
@@ -110,15 +110,15 @@ def update_product(product_id: str, updated_product: Product):
|
|
| 110 |
raise HTTPException(status_code=404, detail="Product not found")
|
| 111 |
|
| 112 |
#DELETE
|
| 113 |
-
@app.delete("/customers/{customer_id}", summary="Delete a customer", description="Allows you to delete a customer by their ID.", tags=["Customers"])
|
| 114 |
-
def delete_customer(customer_id: str):
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
@app.delete("/products/{product_id}", summary="Delete a product", description="Allows you to delete a product by its ID.", tags=["Products"])
|
| 122 |
-
def delete_product(product_id: str):
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 110 |
raise HTTPException(status_code=404, detail="Product not found")
|
| 111 |
|
| 112 |
#DELETE
|
| 113 |
+
# @app.delete("/customers/{customer_id}", summary="Delete a customer", description="Allows you to delete a customer by their ID.", tags=["Customers"])
|
| 114 |
+
# def delete_customer(customer_id: str):
|
| 115 |
+
# initial_length = len(efd.customers)
|
| 116 |
+
# efd.customers = [c for c in efd.customers if c["customer_id"] != customer_id]
|
| 117 |
+
# if len(efd.customers) < initial_length:
|
| 118 |
+
# return {"message": "Customer successfully deleted !"}
|
| 119 |
+
# raise HTTPException(status_code=404, detail="Customer not found")
|
| 120 |
+
|
| 121 |
+
# @app.delete("/products/{product_id}", summary="Delete a product", description="Allows you to delete a product by its ID.", tags=["Products"])
|
| 122 |
+
# def delete_product(product_id: str):
|
| 123 |
+
# efd.products = [p for p in efd.products if p["product_id"] != product_id]
|
| 124 |
+
# return {"message": "Product successfully deleted !"}
|