implement delete order

This commit is contained in:
2025-11-02 18:41:12 +02:00
parent 025236013f
commit 8a2bad78fa
2 changed files with 53 additions and 2 deletions

View File

@@ -164,9 +164,23 @@ class Orders:
return []
def remove_product_from_order(self, order_id, product_id):
with sqlite3.connect(self.db_path) as conn:
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute('''
DELETE FROM orders_products WHERE orders_id=? and product_id=?;
''', (order_id, product_id))
conn.commit()
def remove_order(self, order_id):
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute('''
DELETE FROM orders_products WHERE orders_id=?;
''', (order_id,))
conn.commit()
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute('''
DELETE FROM orders WHERE id=?;
''', (order_id,))
conn.commit()