implement delete order
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user